Sky Kelsey Sky Kelsey - 2 years ago 53
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?

Answer Source
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().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download