I\'m developing a social networking app and our users can connect their Instagram account to our service. I\'d like to open Instagram profiles directly in their official And
Kotlin Version of @jhondge answer:
val uriForApp: Uri = Uri.parse("http://instagram.com/_u/xxx")
val forApp = Intent(Intent.ACTION_VIEW, uriForApp)
val uriForBrowser: Uri = Uri.parse("http://instagram.com/xxx")
val forBrowser = Intent(Intent.ACTION_VIEW, uriForBrowser)
forApp("com.instagram.android")
try {
startActivity(context, forApp, null)
} catch (e: ActivityNotFoundException) {
startActivity(context, forBrowser, null)
}