android 如何知道应用程序是否安装成功
如何知道某个应用程序是否已在 Android 中成功安装?我使用以下方法来安装 apk 文件。
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivity(intent);
How can I know if an app has been installed successfully in android? I am using the following method to install apk files.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivity(intent);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需传递您需要检查的应用程序的包名称来调用该方法即可。
Just call the method by passing the package name of the application you need to check.
您可以查询已安装的软件包列表并查找刚刚安装的软件包:
List pkgAppsList = context.getPackageManager().getInstalledPackages();
http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstalledPackages%28int%29
You can query the list of installed packages and look for the one you just installed:
List pkgAppsList = context.getPackageManager().getInstalledPackages();
http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstalledPackages%28int%29