Directing users to an app listing on the Google Play Store from an Android application should attempt to open the native Play Store app via market:// before falling back to web browser URLs.
Kotlin Play Store Intent Example
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.net.Uri
fun openPlayStorePage(context: Context, packageName: String) {
try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName"))
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
// Fallback to web browser if Play Store app is not installed
val webIntent = Intent(Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=$packageName"))
context.startActivity(webIntent)
}
}
Comments and corrections