-
打开应用详情设置权限等
Intent i = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");String pkg = "com.android.settings"; String cls = "com.android.settings.applications.InstalledAppDetails"; i.setComponent(new ComponentName(pkg, cls)); i.setData(Uri.parse("package:" +mActivity.getPackageName())); startActivity(i);
-
检测下的apk版本等
/** * 检测已经下载的版本 * @return 是否下载 */ public boolean checkDownload() { PackageManager pm = this.getPackageManager(); PackageInfo packageInfo = pm.getPackageArchiveInfo(saveFileName, PackageManager.GET_ACTIVITIES); if (packageInfo != null) { ApplicationInfo appInfo = packageInfo.applicationInfo; /**获取apk的图标 */ appInfo.sourceDir = saveFileName; appInfo.publicSourceDir = saveFileName; Drawable apk_icon = appInfo.loadIcon(pm); /** 得到包名 */ String packageName = packageInfo.packageName; /** apk的绝对路径 */ /** apk的版本名称 String */ String versionName = packageInfo.versionName; /** apk的版本号码 int */ int versionCode = packageInfo.versionCode; /**安装处理类型*/ ToastUtil.showToast(versionCode + "apk" + versionName + packageName); }
- 应用间跳转 (跳转到百度地图为例)
Intent intent = new Intent();
intent.setData(Uri.parse("baidumap://map/newsassistant"));
String path = Environment.getDataDirectory().getPath();
if (new File(path +"/data/"+ "com.baidu.BaiduMap").exists()) {
--最好通过获取已经下载的应用包名来遍历判断,这样判断如果apk卸载不干净也会存在包名🤐
// startActivity(intent);
} else {
ToastUtil.showToast("未安装百度地图");
}
return true;
} else {
ToastUtil.showToast("meiyou开始下载");
return false;
}