open link of google play store in mobile version android
You'll want to use the specified market
protocol:
final String appPackageName = "com.example"; // Can also use getPackageName(), as below
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
Keep in mind, this will crash on any device that does not have the Market installed (the emulator, for example). Hence, I would suggest something like:
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("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
While using getPackageName()
from Context
or subclass thereof for consistency (thanks @cprcrack!). You can find more on Market Intents here: link.
Below code may helps you for display application link of google play sore in mobile version.
For Application link :
Uri uri = Uri.parse("market://details?id=" + mContext.getPackageName());
Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(myAppLinkToMarket);
} catch (ActivityNotFoundException e) {
//the device hasn't installed Google Play
Toast.makeText(Setting.this, "You don't have Google Play installed", Toast.LENGTH_LONG).show();
}
For Developer link :
Uri uri = Uri.parse("market://search?q=pub:" + YourDeveloperName);
Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(myAppLinkToMarket);
} catch (ActivityNotFoundException e) {
//the device hasn't installed Google Play
Toast.makeText(Settings.this, "You don't have Google Play installed", Toast.LENGTH_LONG).show();
}
You can use Android Intents library for opening your application page at Google Play like that:
Intent intent = IntentUtils.openPlayStore(getApplicationContext());
startActivity(intent);
Documentation on d.android.com: http://developer.android.com/distribute/googleplay/promote/linking.html