How to open the Google Play Store application from my application to install the latest version of my application in the play store

I had a question about a script to update an application from an application. Basically, I send the version of the application from the application to the application server, and then decide whether to show the screen to remind you to update the application or not. On the application update reminder screen, there are 2 options for “update now” or “ignore”.

A requirement is an update. Now you should open the application for the playback store, and my application has already searched on it.

I implemented the following code:

try {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName)));
} catch (android.content.ActivityNotFoundException anfe) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appName)));
}

There are two problems:

1) . , , .

2) Play Store 2 (Uninstall and Open). .

-, , - .

+4
2

, . , ? Play Store , .

, Play . , Play , , . , .

, new task . .

try {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appName));
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(i);
} catch (android.content.ActivityNotFoundException anfe) {
    ...
}

, - , ​​ . , "" "".

+3

1) , , .

2) , , , , .

0

Source: https://habr.com/ru/post/1502516/


All Articles