Use the following code snippet to, add an option in app that allow user to rate and review your app on Google Play or Amazon store. You can call getPackageName() and construct the Intent to open the on Google play app using Intent.ACTION_VIEW.

public static void reviewOnGooglePlay(Activity activity) {
        final String appPackageName = activity.getPackageName();
        try {
            activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
        } catch (android.content.ActivityNotFoundException e) {
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
}

If you have published your application on Amazon play store. You can use the following code snippet.

public static void reviewOnAmazon(Activity activity) {
        final String appPackageName = activity.getPackageName();
        try {
            activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("amzn://apps/android?p=" + appPackageName)));
        } catch (android.content.ActivityNotFoundException anfe) {
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.amazon.com/gp/mas/dl/android?p=\"" + appPackageName)));

    }
Tagged in : #Android

Stacktips

StackTips provides programming tutorials, how-to guides and code snippets on different programming languages. Follow us on Twitter

Join The Discussion

Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.