apk 安装 删除
引用:
01 |
//安装apk文件 |
02 |
03 |
private void installAPK(File file) { |
04 |
Intent intent = new Intent(Intent.ACTION_VIEW); |
05 |
Uri data = Uri.fromFile(file); |
06 |
String type = "application/vnd.android.package-archive" ; |
07 |
intent.setDataAndType(data, type); |
08 |
startActivity(intent); |
09 |
} |
10 |
11 |
|
12 |
13 |
//卸载apk文件 |
14 |
15 |
private void uninstallAPK(String packageName) { |
16 |
Intent intent = new Intent(Intent.ACTION_VIEW); |
17 |
Uri data = Uri.parse( "package:" + packageName); |
18 |
intent.setData(data); |
19 |
startActivity(intent); |
20 |
} |
21 |