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
• 13,620 points
4,325 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
• 12,690 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
• 13,620 points
519 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
• 12,690 points
554 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
• 1,830 points
437 views
0 votes
1 answer

Opt out or How to stop google bot accounts from my app?

It sounds like you are experiencing an ...READ MORE

answered Mar 18, 2023 in Android by pooja
593 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,680 points
858 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,210 points
1,966 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
• 5,430 points
712 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
• 63,600 points
592 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
• 12,690 points
1,610 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