Tutorials Android How to Add Rate On Google Play Button in Android

How to Add Rate On Google Play Button in Android

Use the following code snippet to, add an option in the app that allows the 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)));

    }
Total
0
Shares
guest
0 Comments
Inline Feedbacks
View all comments
Previous Post
Android Tutorials

Invite People to Download App Using Firebase AppInviteInvitation

Next Post
Android Tutorials

How to Use Custom Chrome Tab in Android

Related Posts
By clicking “Allow All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookie Notice
Allow All
0
Would love your thoughts, please comment.x
()
x