用这个解决:how to open android application if installed and go to android market if not install
我需要检查一个应用程序是否安装在启动之前,如果没有提示用户祝酒词,如“应用程序未安装,请按从市场下载”或自动链接到市场。
我的应用程序(main)是一个带有2个按钮的with视图:
如果我按下#1 (下载)按钮,我可以正确地从PlayStore下载应用程序,如果我按下按钮#2,下载的应用程序将正确启动。
但是如果我在应用程序未安装时按下button#2,我就会崩溃。我怎么才能阻止这一切?
我的代码是:
if(url.equals("inkstudio://market")){
Intent lancia = new Intent(Intent.ACTION_VIEW);
lancia.setData(Uri.parse("market://details?id=com.aurasma.aurasma"));
startActivity(lancia);
}
if(url.equals("inkstudio://lancia")){
Intent lancia = new Intent(Intent.ACTION_VIEW);
lancia.setData(Uri.parse("aurasma://?YXVyYXNtY"));
startActivity(lancia);
}发布于 2013-09-04 19:57:51
您需要以编程方式在设备中搜索已安装的应用程序。看看这个:
How to check programmatically if an application is installed or not in Android?
https://stackoverflow.com/questions/18622629
复制相似问题