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, 2022 in Android by Edureka
• 12,880 points
224 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, 2022 by Edureka
• 11,450 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, 2022 in Android by Edureka
• 12,880 points
56 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, 2022 in Android by Edureka
• 11,450 points
60 views
–1 vote
0 answers

Android Open and Save files to/from Google Drive SDK

I've been poring at Google documents for ...READ MORE

Dec 10, 2022 in Android by sarit
• 390 points
94 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, 2022 in Android by Edureka
• 12,880 points
93 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, 2022 in Others by Rahul
• 9,670 points
127 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, 2022 in Others by nisha
• 2,190 points
397 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, 2022 in Android by Ashwini
• 2,960 points
62 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, 2022 in Others by narikkadan
• 53,520 points
141 views
0 votes
1 answer
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, 2022 in Android by Edureka
• 11,450 points
216 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