How to open the Google Play Store directly from my Android application

0 votes

I have entered the following code to access the Google Play store.

Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=my packagename "));
startActivity(i);.

However, it displays a Complete Action View for me to choose the (browser/play store) option. I have to directly access the application in the Play Store.

Nov 3 in Android by Edureka
• 12,390 points
45 views

1 answer to this question.

0 votes

If you want to link to your products from an Android app, create an Intent that opens a Google Play URL, as shown in the example below.

final String appPackageName = getPackageName();

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

We use a try/catch block here because an Exception will be thrown if the Play Store is not installed on the target device.

answered Nov 7 by Edureka
• 10,880 points

Related Questions In Android

0 votes
0 answers

How to play YouTube video in my Android application?

How can I embed YouTube videos in ...READ MORE

Nov 15 in Android by Edureka
• 12,390 points
18 views
0 votes
0 answers

How do I open any app from my web browser (Chrome) in Android?

I want to use my web browser ...READ MORE

Nov 16 in Android by Edureka
• 10,880 points
23 views
0 votes
1 answer

How to set my Activity as main activity in android?

The "intent-filter" in "AndroidManifest.xml" allows you to ...READ MORE

answered Nov 8 in Android by Edureka
• 12,390 points
36 views
0 votes
0 answers

How to keep marker on road? Google Maps Android

I'm working on an app that displays ...READ MORE

Nov 9 in Android by Edureka
• 10,880 points
26 views
0 votes
1 answer

How to open the Google Play Store directly from my Android application?

By using developer.andriod.com, one can solve this ...READ MORE

answered Feb 8 in Others by Rahul
• 9,680 points
82 views
0 votes
1 answer

How to open the Google Play Store directly from my Android application?

To open Google Play AND ONLY Google ...READ MORE

answered Jun 6 in Others by nisha
• 2,190 points
211 views
0 votes
0 answers

How to open the Google Play Store directly from my Android application?

I have open the Google Play store ...READ MORE

Nov 23 in Android by Ashwini
• 2,760 points
21 views
0 votes
1 answer

A/B Testing for builds in Google Play

there is a staged roll out feature ...READ MORE

answered Feb 18 in Others by narikkadan
• 37,660 points
96 views
0 votes
1 answer

How to turn on front flash light programmatically in Android?

For this problem you should: Check whether the ...READ MORE

answered Nov 8 in Android by Edureka
• 10,880 points
43 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP