Skip to content

Instantly share code, notes, and snippets.

@VarunBarad
Created February 15, 2018 06:41
Show Gist options
  • Save VarunBarad/c6a799610c82005e60908a6b2e46f490 to your computer and use it in GitHub Desktop.
Save VarunBarad/c6a799610c82005e60908a6b2e46f490 to your computer and use it in GitHub Desktop.

Revisions

  1. Varun Barad created this gist Feb 15, 2018.
    14 changes: 14 additions & 0 deletions MainActivity.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    // Java
    public void rateApp(View rateMeButton) {
    String packageName = this.getPackageName();
    String playStoreAppUri = "market://details?id=" + packageName;
    String playStoreSiteUri = "https://play.google.com/store/apps/details?id=" + packageName;

    try {
    Intent playStoreAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreAppUri));
    startActivity(playStoreAppIntent);
    } catch (ActivityNotFoundException e) {
    Intent playStoreBrowserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(playStoreSiteUri));
    startActivity(playStoreBrowserIntent);
    }
    }