I need to make rate option in my app. I want to just provide ability for users to rate my app on Google Play.
Asked
Active
Viewed 1,684 times
1
-
1Possible duplicate of [Rate Google Play application directly in app](https://stackoverflow.com/questions/11270591/rate-google-play-application-directly-in-app) – GvS Aug 29 '19 at 09:22
-
Yes, but this solution is on Java, but I need solution on Kotlin – Serhii Stakhiv Aug 29 '19 at 09:32
-
1Copy/Paste the Java code to a Kotlin file, and Android Studio will be happy to convert the code instantly. – GvS Aug 29 '19 at 09:43
-
Yes, Android Studio is cool!)) Does "Intellij Idea" also be able to convert Java code to Kotlin code? – Serhii Stakhiv Aug 29 '19 at 09:51
-
By the way, this method doesn`t always work – Serhii Stakhiv Aug 29 '19 at 09:52
1 Answers
1
I found solution (Kotlin):
fun rateApp() {
val uri = Uri.parse("market://details?id=$packageName")
val myAppLinkToMarket = Intent(Intent.ACTION_VIEW, uri)
try {
startActivity(myAppLinkToMarket)
} catch (e: ActivityNotFoundException) {
Toast.makeText(this, "Impossible to find an application for the market", Toast.LENGTH_LONG).show()
}
}
P.S. This code does not work on the simulator, use a real device.

Serhii Stakhiv
- 936
- 7
- 11