Sky Kelsey Sky Kelsey - 4 months ago 8x
Android Question

Open Google play as a new application

I'm currently opening Google Play the way that is described many places: by starting a new intent pointing at the market, as described here:

open link of google play store in mobile version android

But that leaves the market open if the user doesn't hit the back button, and instead clicks on my app's icon again.

Is there an easy way to force Google Play to load in its own application, instead of as a new Activity on top of mine?

public void goToMarket(){
    Uri uri = Uri.parse("market://details?id=" + getPackageName());
    Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
    try {
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, getResources().getString(R.string.errorLaunchMarket), Toast.LENGTH_LONG).show();

As stated you could add the Intent.FLAG_ACTIVITY_NEW_TASK to your setFlags().