Open link google play store in the mobile version of Android

I have a link to other applications in my last application, and I open them that way.

Uri uri = Uri.parse("url"); Intent intent = new Intent (Intent.ACTION_VIEW, uri); startActivity(intent); 

these codes open the google play browser version in the browser.

When I try to open from my phone, the phone will tell me if I want to use a browser or Google Play, and if I choose the second, the mobile version of the Google play store will open.

Can you tell me how this can happen right away? I do not mean to ask me, but directly open the mobile version of the Google game, which I see by opening it directly from the phone.

+88
android google-play
Jun 06 '12 at 21:45
source share
8 answers

You 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))); 

Remember that this will work on any device that does not have Market installed (for example, an emulator). Therefore, 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))); } 

When using getPackageName() from Context or a subclass for consistency (thanks @cprcrack !). You can find more information about market intentions here: link .

+264
Jun 6 '12 at 21:59
source share

Below is the code that can help you regarding the link to the app with the google play sore image in the mobile version.

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(); } 

Link for the developer:

 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(); } 
+6
Sep 12 '13 at 7:19
source share

You can use Android Intents to open your application page on Google Play:

 Intent intent = IntentUtils.openPlayStore(getApplicationContext()); startActivity(intent); 
+3
Aug 20 '13 at 8:28
source share

You can check if the Google Play Store application is installed, and if so, you can use the "market: //" protocol.

 final String my_package_name = "........." // <- HERE YOUR PACKAGE NAME!! String url = ""; try { //Check whether Google Play store is installed or not: this.getPackageManager().getPackageInfo("com.android.vending", 0); url = "market://details?id=" + my_package_name; } catch ( final Exception e ) { url = "https://play.google.com/store/apps/details?id=" + my_package_name; } //Open the app page in Google Play store: final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(intent); 
+1
Apr 10 '14 at 10:14
source share

Open the application page on Google Play:

 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())); startActivity(intent); 
0
May 26 '15 at 13:13
source share

Alright it's alright

And I will need your help because thank you.

0
Apr 25 '19 at 15:45
source share

Try this:

 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(browserIntent); 

This works great for me.

As for the missing "http: //", I would just do something like this:

 if (!url.startsWith("http://example.com") && !url.startsWith("https://play.google.com/store/apps/details?id=com.CRE8.Example")) url = "http://" + url; 

I would also probably pre-populate your EditText so that the user enters the URL using "http: //".

-2
May 10 '19 at 5:15
source share



All Articles