@@ -34,8 +34,24 @@ public static void gotoPlayStore(Activity context, String APP_ID) {
34
34
try {
35
35
context .startActivity (goToMarket );
36
36
} catch (ActivityNotFoundException e ) {
37
- context .startActivity (new Intent (Intent .ACTION_VIEW ,
38
- Uri .parse ("http://play.google.com/store/apps/details?id=" + APP_ID )));
37
+ Uri link = Uri .parse ("http://play.google.com/store/apps/details?id=" + APP_ID );
38
+ Intent intent = new Intent (Intent .ACTION_VIEW , link );
39
+ context .startActivity (intent );
40
+ }
41
+ }
42
+
43
+ public static void gotoPlayStore (Activity context , String APP_ID , int request ) {
44
+ Uri uri = Uri .parse ("market://details?id=" + APP_ID );
45
+ Intent goToMarket = new Intent (Intent .ACTION_VIEW , uri );
46
+ // To count with Play market backstack, After pressing back button,
47
+ // to taken back to our application, we need to add following flags to intent.
48
+ goToMarket .addFlags (Intent .FLAG_ACTIVITY_NO_HISTORY | Intent .FLAG_ACTIVITY_MULTIPLE_TASK );
49
+ try {
50
+ context .startActivity (goToMarket );
51
+ } catch (ActivityNotFoundException e ) {
52
+ Uri link = Uri .parse ("http://play.google.com/store/apps/details?id=" + APP_ID );
53
+ Intent intent = new Intent (Intent .ACTION_VIEW , link );
54
+ context .startActivityForResult (intent , request );
39
55
}
40
56
}
41
57
0 commit comments