How to programmatically disable apps without root?

android developer picture android developer · Apr 21, 2016 · Viewed 7.4k times · Source

I've just found an app that allows to disable Samsung apps without root, and in the background:

https://play.google.com/store/apps/details?id=com.hecorat.packagedisabler

And also this free one:

https://play.google.com/store/apps/details?id=com.ospolice.packagedisabler

  1. How could this be? It doesn't even show a system-type alertDialog to ask the user if it's ok to disable the app. Did they find a flaw that allows doing so?

  2. Is it only for Some Samsung apps? What about other apps and other companies? Is is possible there too?

  3. Could the same mechanism be used for other operations? Like enabling apps?

I currently don't have a Samsung device, so I can't even check this app.

Answer

Pinks picture Pinks · Apr 21, 2016

You can hide or unhide the apps provided you make your app as device owner with the api setApplicationHidden of DevicePolicyManager