I’m trying to open the App Gallery store to update my app, but app is not found.
I tried opening other applications with other ids but with no success. Also i tried used “market://details?id=” scheme. AppGallery opens, but no application information is found.
Maybe i need to use an another scheme?
val marketIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("appmarket://details?id=C107473825")
)
val preferMarketResolveInfo = getAppResolveInfo(
context = context,
intent = marketIntent,
packageName = marketDeeplink.preferMarketPackageName
)
val componentName = preferMarketResolveInfo?.let {
ComponentName(it.activityInfo.packageName, it.activityInfo.name)
}
marketIntent.setComponent(componentName)
startActivity(marketIntent)
private fun getAppResolveInfo(
context: Context,
intent: Intent,
packageName: String?
): ResolveInfo? {
val allActivitiesForIntent = context.packageManager.queryIntentActivities(intent, 0)
val preferResolveInfo = allActivitiesForIntent.find { resolveInfo ->
resolveInfo.activityInfo.applicationInfo.packageName == packageName
}
return preferResolveInfo
}
result
New contributor
north is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.