flagg327
flagg327

Reputation: 1007

How to share the link of an app if i don't know what URL it will have

How to implement "share app" button if i still don't know what URL the app will have in play store (the app hasn't been released yet).

Upvotes: 0

Views: 611

Answers (3)

priyankvex
priyankvex

Reputation: 6050

It's better to use

context.getPackageName()

You can use market:// protocol to open the app in play store app. But mind it, this will crash the app if play store is not installed.

You can use the following :

final String appPackageName = getPackageName(); // Use this method to get the package name. Instead of hard coding it.
try {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
}

Upvotes: 2

user5292387
user5292387

Reputation: 413

An easy, if inelegant, solution is to just not have the "share app" button in your first release on Day 1. Once you know the URL of your app's appstore entry, you can add the "share app" feature and upload and release version 1.1 or 1.0.1 of your app on Day 2.

ETE: To give your problem some context: If you think you need the "share app" feature on Day 1 because you're going to have a million downloads on Day 1, then do you really need the "share app" feature? If you think you're only going to have a handful of downloads on Day 1, then not having that feature available on Day 1 probably isn't going to make or break your app.

See also: MVP, minimum viable product.

Upvotes: 0

Pacific P. Regmi
Pacific P. Regmi

Reputation: 1607

Every play store app URL contain app package name. So if your application package name is com.yourappname then your play store URL is like this.

https://play.google.com/store/apps/details?id=com.yourappname

I hope this will help you.

Upvotes: 2

Related Questions