I am trying to code an application that calls a method in android StatusBarManager. I did it the same way as hacking to extend the Android status bar:
try { Object service = getSystemService("statusbar"); Class<?> statusbarManager = Class.forName("android.app.StatusBarManager"); Method expand = statusbarManager.getMethod("disable", new Class[] { int.class }); expand.invoke(service, 0x00200000); } catch (Exception e) { e.printStackTrace(); System.out.println("DISABLE HOME ERROR"); }
Other than the method that I want to call, disable () instead of expand (). However, I get a security exception "neither the user nor the current process has permission android.permission.STATUS_BAR.
I tried to add it to the manifest, but since this is the permission of system applications, it only works if I copy my application to / system / app.
I mixed up with RootTools http://code.google.com/p/roottools/ , but could not figure out how to set permissions. I tried setPermissions (0) and setUserPermissions ("android.permissions.status_bar"), but no one works. I am not sure how to use this library.
Any help would be greatly appreciated!
source share