Search code examples
androidsecurityexception

how to disable status bar in android


I am working on message app there i want to disable the status bar it should be shown but not touchable.

i have tried below code: In Activity:

StatusBarManager mStatusBarManager = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);

mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);

In Manifest i have also added the permission :

But i am getting following error:

Caused by: java.lang.SecurityException: StatusBarManagerService: Neither user 10004 nor current process has android.permission.STATUS_BAR.


Solution

  • Resolved! By adding android:sharedUserId="android.uid.system" in Manifest file and LOCAL_CERTIFICATE = platform in Android.mk file