0

How to remove app for multiple Users ?

So question is that I have tablet and that have more then one users. When i install app for one user(Owner) then it install for all users. But when i remove app programatically then it doens't remove for all users.

So can you please tell me how to remove app for all users. Tablet have root permission and i am currently using this snippet

Process proc = Runtime.getRuntime().exec("su -c pm install -r " + filename);
proc.waitFor();

So it ll update my application and i also increased the Version code for app everytime. So version code is not an issue.

So can you please tell me how to uninstall app for all users.

Problem occurs when i run this code it uninstall the previous app but for "Current User" not for all users.

Please suggest me a way to do that. Root No Root All answers ll be accepted :)

Harsh Patel
  • 1,056
  • 2
  • 10
  • 20

1 Answers1

2

Try this:

final Uri packageURI = Uri.parse("package:" + "some.package.name");
final Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageURI);
uninstallIntent.putExtra("android.intent.extra.UNINSTALL_ALL_USERS", false or true);
startActivity(uninstallIntent);

I've seen it already ansewred in SO here:

Is there an intent for uninstallation of an app for ALL users?

Community
  • 1
  • 1
Juan
  • 2,156
  • 18
  • 26