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);
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:
<button android:text=
"@string/rate_button"
android:id=
"@+id/ButtonRate"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:onclick=
"rate"
android:layout_marginbottom=
"10dip"
></button>
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.
No comments:
Post a Comment