我需要检查Android Market是否像这样安装
/*
* Test for existence of Android Market
*/
boolean androidMarketExists = false;
try{
ApplicationInfo info = getPackageManager()
.getApplicationInfo("com.google.process.gapps", 0 );
//application exists
androidMarketExists = true;
} catch( PackageManager.NameNotFoundException e ){
//application doesn't exist
androidMarketExists = false;
}
Run Code Online (Sandbox Code Playgroud)
但我不知道com.google.process.gapps是否是具有Android市场的软件包.
Reu*_*ton 19
这是com.android.vending(在我的Galaxy S上),这里有更好的方法来查找...通过查询谁处理market:// URIs.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://search?q=foo"));
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
Run Code Online (Sandbox Code Playgroud)
如果列表至少有一个条目,那么市场就在那里.
归档时间: |
|
查看次数: |
15631 次 |
最近记录: |