Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement Rate Us in android

Tags:

android

I have made an application now i want to implement Rate Us feature in it. so for that i have added this code in my app

i = new Intent(Intent.ACTION_VIEW , Uri.parse("market://details?id=com.bet.compny"));
startActivity(i);
break;

but when i click on the button for rate us getting force close. here is my log cat output.

android.content.ActivityNotFoundException: No Activity found to handle Intent {     
act=android.intent.action.VIEW dat=market://details?id=com.bet.compny }

Any help would be appretiated.

like image 883
sachit Avatar asked Oct 21 '12 13:10

sachit


People also ask

How do you ask someone to rate your app?

You can set up a pre-request via Batch before displaying the Apple or Android native In-App. Users will receive a first In-App push asking them if they want to rate the app or not. If users answer yes, then, the native in-app will appear.

How does Google Play rating work?

Play Store ratings for apps, and the corresponding bar graphs showing the proportional number of 1, 2, 3, 4 and 5 star reviews, are calculated based on the app's current quality ratings from user reviews, rather than the lifetime average value of user reviews, unless the app has very few ratings.


2 Answers

This error occurs when running on a device without the Google PlayStore. I guess you might be running this on a emulator device which doesn't have Playstore and hence the error.

Implement using try catch as follows:

try{
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+getPackageName())));
    }
    catch (ActivityNotFoundException e){
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName())));
    }
like image 161
shashank chandak Avatar answered Nov 16 '22 01:11

shashank chandak


Idk why you get the Error, but this should actually work. I also do it like this:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));

But keep in mind that this would crash, if you are testing it on an Emulator/ a device without a play store. So I would suggest you to wrap it in a try and catch

like image 32
Ahmad Avatar answered Nov 16 '22 03:11

Ahmad