How To Drop Down Status Bar Programmatically Android
Possible Duplicate: How can I programmatically open/close notifications in Android? I need a code that will drop down the status bar in android programmatically. Is there any wa
Solution 1:
Use this code anywhere.
Object sbservice = getSystemService( "statusbar" );
Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" );
Method expandMethod;
if (Build.VERSION.SDK_INT >= 17) {
expandMethod = statusBarManager.getMethod("expandNotificationsPanel");
} else {
expandMethod = statusBarManager.getMethod("expand");
}
expandMethod .invoke( sbservice );
Or to make it more short use this :
StatusBarManagerstatusBar= (StatusBarManager) getSystemService(STATUS_BAR_SERVICE);
statusBar.expand();
Permission is required in manifest.
<uses-permissionandroid:name="android.permission.EXPAND_STATUS_BAR" />
Post a Comment for "How To Drop Down Status Bar Programmatically Android"