1

Have you ever used public void uninstall (String packageName, IntentSender statusReceiver)' ofPackageInstaller` ? This is new API added in apilevel 21.

And this API description is

Uninstall the given package, removing it completely from the device. This method is only available to the current "installer of record" for the package.

what does 'installer of record' mean here??

YanceyWang
  • 77
  • 1
  • 6
  • I would presume that "installer of record" means the Play Store on Google Play devices, Amazon AppStore for Android for the Kindle Fire series and Fire TV series, etc. – CommonsWare May 26 '15 at 14:24
  • @CommonsWare so ,according to your presumption, can i understand that this api cannot be used by my app to uninstall other apps and is only available to the stores who installed the packages? – YanceyWang May 26 '15 at 14:41
  • That would be my guess, yes. You should be able to use [`ACTION_UNINSTALL_PACKAGE`](http://developer.android.com/reference/android/content/Intent.html#ACTION_UNINSTALL_PACKAGE) on API Level 14+ to trigger an uninstallation. – CommonsWare May 26 '15 at 14:59

2 Answers2

0

Following the PackageInstaller code shows that the uninstall() session is bound to a PackageInstaller.Session which only works from the same installerPackageName.

So you can only uninstall an app installed from the same installer, e.g. a market application (which is what they seem to mean with 'installer of record').

(Can't comment, yet so I wrote this into a new answer).

tony
  • 216
  • 1
  • 7
  • So `PackageInstaller` can't be used as a standalone solution to remove any package from a system. If I do `packageManager.packageInstaller.uninstall(packageName, pendingIntent.intentSender)` then nothings happens. – Sudhir Singh Khanger Jun 03 '20 at 06:32
0

This can also be called by the device owner application.

Android M and up

amalBit
  • 12,041
  • 6
  • 77
  • 94