Search

Thursday, July 21, 2011

Adding a button to rate your app in the Market

When you publish an application on the Market is usually a great idea to encourge your users to rate it.

The percentage of users who rate applications is usually very low, so putting a button to facilitate the work is one of the best strategies to get a lot of rates.

And it's very simple, basically you must launch an Intent with a url to the market, and it does all the work alone.

public void rate(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.trackeen.sea"));
startActivity(intent);
}

Obviously you must change the name for the package, to yours.

And for the button you must include something like this in the view:



And that's all.

Note: If you test launching the market in the Android emulator you will get the following error:



ERROR/AndroidRuntime(230): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.trackeen.sea }

Don't worry, the Market doesn't work in emulators, when you try this code in a real device it will work.

13 comments:

  1. What lines did you have to put in your androidManifest.xml file?

    ReplyDelete
  2. Nothing special. I think the only that must be present is:

    ReplyDelete
  3. You should check if the intent can be handled before launching it. In china or in the amazon kindle for instance, there is no google play and it will probably fail.

    ReplyDelete
  4. How can I know if user has rated the app. So that I don't ask user to rate my app again.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete