如何检测的Andr​​oid市场对设备的存在? [英] How to detect the existence of Android Market on devices?

查看:123
本文介绍了如何检测的Andr​​oid市场对设备的存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些Android设备没有Android的市场,如韩国等。

是否有可能在运行时检测Android电子市场的存在?

我知道我可以尝试先打开市场URI来看看是否有任何抛出的异常。但我不认为这是一个明智的做法。

解决方案
  

我知道我可以尝试打开市场的URI   首先,以查看是否有任何异常   抛出。

创建 ACTION_VIEW 意图为市场乌里 ,然后用 PackageManager queryIntentActivities()来看看你得到任何东西。如果返回一个空的列表,你什么都不知道在设备上处理市场乌里值。

Some Android devices don't have Android Market, like Korea, etc.

Is it possible to detect the existence of Android Market at runtime?

I know I can try to open a market uri first to see if there is any exception thrown. But I don't think this is a wise approach.

解决方案

I know I can try to open a market uri first to see if there is any exception thrown.

Create the ACTION_VIEW Intent for the Market Uri, then use PackageManager and queryIntentActivities() to see if you get anything back. If that returns an empty list, you know nothing on the device handles Market Uri values.

这篇关于如何检测的Andr​​oid市场对设备的存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆