Skip to main content
Improved formatting.
Source Link

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APPAll of the above answers open Google Play in a new view of the same app, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAYif you actually want to open Google Play (or any other app)INDEPENDENTLY independently:

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending"); 

// package name and activity
ComponentName comp = new ComponentName("com.android.vending",
                                       "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); // package name and activity
    launchIntent.setComponent(comp); 

// sample to open facebook app
launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));
 
    startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody) Most of what I have seen uses the approach of the other answers and it was not what I needed hopefully this helps somebody.

Regards.

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY (or any other app)INDEPENDENTLY:

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
    ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); // package name and activity
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));
 
    startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

Regards.

All of the above answers open Google Play in a new view of the same app, if you actually want to open Google Play (or any other app) independently:

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending"); 

// package name and activity
ComponentName comp = new ComponentName("com.android.vending",
                                       "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); 
launchIntent.setComponent(comp); 

// sample to open facebook app
launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));
startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

Most of what I have seen uses the approach of the other answers and it was not what I needed hopefully this helps somebody.

Regards.

deleted 58 characters in body
Source Link
code4jhon
  • 6k
  • 10
  • 42
  • 60

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY (or any other app)INDEPENDENTLY:

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
    ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); // package name and activity
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));

    startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

https://github.com/code4jhon/org.apache.cordova.startapp

Regards.

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY (or any other app)INDEPENDENTLY:

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
    ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); // package name and activity
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));

    startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

https://github.com/code4jhon/org.apache.cordova.startapp

Regards.

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY (or any other app)INDEPENDENTLY:

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
    ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); // package name and activity
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));

    startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

Regards.

modified to shows like native not cordova like
Source Link
code4jhon
  • 6k
  • 10
  • 42
  • 60

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY INDEPENDENTLY(or any other app)INDEPENDENTLY:

   public void start(JSONArray args, CallbackContext callback) {

Intent launchIntent;
String packageName;
String activity;
String uri;
ComponentName comp;

try {
    packageNamelaunchIntent = args.getStringgetPackageManager(0); //com.getLaunchIntentForPackage("com.android.vendingvending");
    activity  ComponentName comp = args.getStringnew ComponentName(1);"com.android.vending", //com"com.google.android.finsky.activities.LaunchUrlHandlerActivity
    uri         = args.getString(2LaunchUrlHandlerActivity"); //'market://details?id=com.triplingo.enterprise'

    launchIntent = this.cordova.getActivity().getPackageManager().getLaunchIntentForPackage(packageName);
    comp =package newname ComponentName(packageName,and activity);
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse(uri));

    this.cordova"market://details?id=com.getActivity()facebook.startActivity(launchIntentkatana");
    callback.success();
} catch (Exception e) {
    callback.error(e.toStringstartActivity()launchIntent);
}
}

As you can see this code is part of a Cordova plugin but it can be applied natively also.

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

https://github.com/code4jhon/org.apache.cordova.startapp

Regards.

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY INDEPENDENTLY:

   public void start(JSONArray args, CallbackContext callback) {

Intent launchIntent;
String packageName;
String activity;
String uri;
ComponentName comp;

try {
    packageName = args.getString(0); //com.android.vending
    activity    = args.getString(1); //com.google.android.finsky.activities.LaunchUrlHandlerActivity
    uri         = args.getString(2); //'market://details?id=com.triplingo.enterprise'

    launchIntent = this.cordova.getActivity().getPackageManager().getLaunchIntentForPackage(packageName);
    comp = new ComponentName(packageName, activity);
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse(uri));

    this.cordova.getActivity().startActivity(launchIntent);
    callback.success();
} catch (Exception e) {
    callback.error(e.toString());
}
}

As you can see this code is part of a Cordova plugin but it can be applied natively also.

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

https://github.com/code4jhon/org.apache.cordova.startapp

Regards.

ALL OF THE ABOVE ANSWERS OPEN GOOGLE PLAY IN A NEW VIEW OF THE SAME APP, IF YOU ACTUALLY WANT TO OPEN GOOGLE PLAY (or any other app)INDEPENDENTLY:

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
    ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); // package name and activity
    launchIntent.setComponent(comp);
    launchIntent.setData(Uri.parse("market://details?id=com.facebook.katana"));

    startActivity(launchIntent);

The important part is that actually opens google play or any other app independently.

(Most of what I have seen uses the approach of the other answers and it was not what i needed hopefully this helps somebody)

https://github.com/code4jhon/org.apache.cordova.startapp

Regards.

added 6 characters in body
Source Link
code4jhon
  • 6k
  • 10
  • 42
  • 60
Loading
deleted 207 characters in body
Source Link
code4jhon
  • 6k
  • 10
  • 42
  • 60
Loading
Source Link
code4jhon
  • 6k
  • 10
  • 42
  • 60
Loading