Raducu Mihai
Raducu Mihai

Reputation: 343

Get the link to your app before publishing it

Hi there I just finished my first app for Android that I want to publish. In my app I have a button which allows users to share the link, to my app in the Google Play Store. Now I don't know how to get that link, because my app isn't published yet. Thanks.

Upvotes: 3

Views: 1143

Answers (2)

Gurjit Singh
Gurjit Singh

Reputation: 1110

You need to know the app's package name which is declared in manifest file.You can link your app -

From an Android app:-

market://details?id=<package_name>

From a web site-

http://play.google.com/store/apps/details?id=<package_name>

Upvotes: 0

Amir Ziarati
Amir Ziarati

Reputation: 15087

the right practice is to call the view intent by market schema using your package name like below:

String yourPackageName = getPackageName();
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + yourPackageName)));
} 
catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + yourPackageName)));
}

Upvotes: 2

Related Questions