0

What i am trying to do is hiding a installed application from another application like this :

PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName("com.example.activitypackgename","com.example.activitypackgename.LauncherActivity");
    p.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

but it is throwing exception

java.lang.SecurityException: Permission Denial: attempt to change component state

code works fine if trying to hide same application. I need to know is their any way to hide a app from another app.? Thanks in advance.

Kapil Rajput
  • 11,429
  • 9
  • 50
  • 65
  • "I need to know is their any way to hide a app from another app.?" - Nope. Maybe on a rooted system, but not on a standard install, unless you want to write a launcher that the user opts to use. Also, what's up with everyone wanting to hide apps these days? – Mike M. Feb 04 '16 at 10:53
  • @MikeM. thanks for your time, but in samsung devices we can manage to hide/unhide apps then why it's not possible to manage this from a app ? – Kapil Rajput Feb 04 '16 at 11:07
  • Well, the Exception has it right in the name. It's a security issue. If any arbitrary app could hide other apps, there could be all sorts of shady shenanigans going on without the user's knowledge. Also, I'm not sure what you're describing on Samsungs, but it sounds like a system function, in which case it's an app with signature/system permissions that a regular app can't get. – Mike M. Feb 04 '16 at 11:20

0 Answers0