Some Android devices do not have Android Market, such as Korea, etc.
Is it possible to detect the existence of the Android Market at runtime?
I know that I can open the uri market first to see if there is any exception. But I do not think this is a wise approach.
I know that I can try to open the uri market first to see if there is any exception thrown.
ACTION_VIEW Intent Market Uri, PackageManager queryIntentActivities(), , . , , Market Uri.
ACTION_VIEW
Intent
Uri
PackageManager
queryIntentActivities()
, .
Context context = this; final PackageManager packageManager = context.getPackageManager(); String packagename = this.getPackageName(); String url = "market://details?id=" + packagename; Intent i2 = new Intent(Intent.ACTION_VIEW); i2.setData(Uri.parse(url)); List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(i2,PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfo.size() > 0) startActivity(i2);
Source: https://habr.com/ru/post/1756691/More articles:Как разместить широкую фигуру с субфигурами в латексе? - latexFile system prototyping - cDjango Hosting on a FastCGI Shared Host - djangoRails: Send a shrimp email to an email sent by ActionMailer? - ruby-on-railsHow to write content type in cakephp? - content-typeUsing AvalonEdit in Sharpdevelop 3.x - c #Enum typed properties in Entity Framework objects? - enumsпроблема cakephp css и изображений на localhost - cakephpHow to find out if the .pem file is correct or not. - php32x32 Multiply and add optimizations - optimizationAll Articles