- 分享应用
public void sendApp(String srdir){
Uri v2 = Uri.fromFile(new File(srdir));
Intent v1 = new Intent("android.intent.action.VIEW");
v1.setDataAndType(v2,"text/plain");
v1.setFlags(67108864);
try {
this.startActivity(v1);
} catch (Exception e) {
Toast.makeText(getAppListActivity.this, "error x 1", 0).show();
}
}
- 卸载应用
public void uninstallApp(String pkn){
Uri v1 = Uri.parse("package:" + pkn);
Intent v0 = new Intent("android.intent.action.DELETE");
v0.setData(v1);
this.startActivity(v0);
}
- 查看权限
private void getAppPermission(String pkn){
PackageManager pm = getPackageManager();
try {
PackageInfo pack = pm.getPackageInfo(pkn, PackageManager.GET_PERMISSIONS);
String[] permissionStrings = pack.requestedPermissions;
String permissionReq = "";
for(String permissionString : permissionStrings){
permissionReq = permissionReq + permissionString + "\n";
}
Toast.makeText(getAppListActivity.this, permissionReq, 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
网友评论