0

Am working on android app on which am inserting data to the database.if i get the result "Ok" from server then i want to redirect it to the playstore url .but when am hitting the url on browser its working fine but when am working with android device its not redirecting to the specified url. here is my server code :

frmRefer.insertReferId(refer);
responseStr.setStatus(ServerResponse.STATUS.OK);
responseStr.setData(refer);
String serialId=responseStr.getData().getSerialId();
response.sendRedirect("https://play.google.com/store/apps/details?id=PACKAGE NAME&referrer=utm_source=admob&utm_medium=cpc&utm_term="+referId+"&utm_campaign=""&anid=admob");
session.commit();
Roman C
  • 49,761
  • 33
  • 66
  • 176

3 Answers3

0

Please try this:

Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=your.app.url"));
startActivity(i);
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
Shoeb Siddique
  • 2,805
  • 1
  • 22
  • 42
0
    Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
    Intent playStoreAppIntent= new Intent(Intent.ACTION_VIEW, uri);

    try {
        startActivity(playStoreAppIntent);
    } catch (ActivityNotFoundException e) {

      Intent playStoreWebIntent= new Intent(android.content.Intent.ACTION_VIEW);
      playStoreWebIntent.setData(Uri.parse("https://play.google.com/store/apps/details?id=<your project package name>"));//YOUR APP URL
      startActivity(playStoreWebIntent);
    }
Mohd Mufiz
  • 2,236
  • 17
  • 28
0
String appPackageName = getPackageName();
    try {
        startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse("market://details?id=" + appPackageName)));
    } catch (android.content.ActivityNotFoundException anfe) {
        startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse("https://play.google.com/store/apps/details?id="
                        + appPackageName)));
    }

Refer this

Community
  • 1
  • 1
wadali
  • 2,221
  • 1
  • 20
  • 38