val newInput = "pm uninstall --user 0 $input"
val process = Runtime.getRuntime().exec(newInput)
process.waitFor()
'input' is the package name that want to remove. I signed the application to make it a system app. When I try to run this code I get:
2020-12-23 11:39:18.313 19993-19993/? E/cutils-trace: Error opening trace file: Permission denied (13) 2020-12-23 11:39:18.489 19993-19993/? E/memtrack: Couldn't load memtrack module (No such file or directory) 2020-12-23 11:39:18.489 19993-19993/? E/android.os.Debug: failed to load memtrack module: -2
How can I remove an application from another application with permission?
For other application removal, you have to get approval from the user. You can perform this process by using intent.
Uri packageURI = Uri.parse("package:"+"some.package.to.remove");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.