非常快,但概念仍然存在,如果您确实希望简单地搜索 Google 服务框架的存在,您可以使用以下内容。
我只发布这个是因为 AFAIK 没有另一种明显的方法。
boolean installed = appInstalledOrNot("com.google.process.gapps");
if(installed)
{
System.out.println("App installed on phone");
}
else
{
System.out.println("App is not installed phone");
}
}
private boolean appInstalledOrNot(String uri)
{
PackageManager pm = getPackageManager();
boolean app_installed = false;
try
{
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
app_installed = true;
}
catch (PackageManager.NameNotFoundException e)
{
app_installed = false;
}
return app_installed ;
}