ywj7931 ywj7931 - 1 month ago 3
Android Question

Android share download link

I want to add share link in my app including the downloading link of android play. But since my app is not launched, I dont have download link currently. How can I include download link now?


This should help you.

final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
    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("https://play.google.com/store/apps/details?id=" + appPackageName)));