Created
February 15, 2018 06:42
-
-
Save VarunBarad/17158545c87737b65e426e10795f7f68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Kotlin | |
public fun rateApp(rateMeButton: View): Unit { | |
val packageName = this.packageName | |
val playStoreAppUri = "market://details?id=$packageName" | |
val playStoreSiteUri = "https://play.google.com/store/apps/details?id=$packageName" | |
try { | |
val playStoreAppIntent = Intent(Intent.ACTION_VIEW, Uri.parse(playStoreAppUri)) | |
startActivity(playStoreAppIntent) | |
} catch (e: ActivityNotFoundException) { | |
val playStoreBrowserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(playStoreSiteUri)) | |
startActivity(playStoreBrowserIntent) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment