dargen
dargen

Reputation: 81

How to open "My account" of Google Play Store programmatically

I want to open up "My account" page of Google Play Store from my app by sending an intent.

I know how to open specific app's product details page in Google play store (Android developers: Linking to Your Products)

such as:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+appName)));

But now I want is to open "My account" to redirect user to check/adjust their payment methods or order history.

Is there any way to open "My account" page programmatically?

enter image description here

Upvotes: 4

Views: 3612

Answers (3)

lazydevpro
lazydevpro

Reputation: 127

Maybe too late but this can be helpful for others.

You have to change the market link like this The link: market://search?q=pub:<publisher_name>

And then you can use it in your code.

One more thing use try catch so if any user doesn't have store installed in his device still visit the link and also prevent the app from crashing.

try{

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:<publisher_name>")));

}catch (android.content.ActivityNotFoundException ex) {

// If the market is not available in the store.
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/developer?id=<publisher_name>")));

}

Upvotes: 0

I don't know if this will work for all cases, but I had the same requirement and I solve it creating an intent to the account URL "https://play.google.com/store/account".

Uri uri = Uri.parse("https://play.google.com/store/account");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(
    Intent.FLAG_ACTIVITY_NO_HISTORY |
    Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
    Intent.FLAG_ACTIVITY_MULTIPLE_TASK
);
context.startActivity(intent);

Upvotes: 2

Ankit Agrawal
Ankit Agrawal

Reputation: 83

Here is the list of ways by which Google Play Store can be called using Intent :

https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html

Upvotes: 1

Related Questions