knightcube
knightcube

Reputation: 159

What to add in the body of a share Intent before launching an android app?

I know how to add a share button in android, but when I click on it I want the intent to store the link of the same app in playstore. However, I don't understand how to do this because I am trying to find the link of an app that hasn't been published yet.

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
sharingIntent.setType("text/plain");
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add the app link here so that it is shown in playstore");
startActivity(Intent.createChooser(sharingIntent, "Share via"));

I know it can be achieved via Firebase Remote configurations, but is there any other way to do so.

Upvotes: 0

Views: 54

Answers (1)

Shashwat Gupta
Shashwat Gupta

Reputation: 872

you can do this by following:

 startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse("http://play.google.com/store/apps/details?id=" + this.getPackageName())));

this is your link after publishing app: "http://play.google.com/store/apps/details?id=" + this.getPackageName()

Upvotes: 1

Related Questions