Open app in Play Store
Write below code when you want to open any app programmatically,
String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
appPackageName = "com.whatsapp";
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)));
}
Here, appPackageName = "com.whatsapp" is static. If you comment that line, your current app open in play store.
String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
appPackageName = "com.whatsapp";
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)));
}
Here, appPackageName = "com.whatsapp" is static. If you comment that line, your current app open in play store.
Comments
Post a Comment