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 way to drop it down ?
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 way to drop it down ?
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 :
StatusBarManager statusBar = (StatusBarManager) getSystemService(STATUS_BAR_SERVICE);
statusBar.expand();
Permission is required in manifest.
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />