How to close the status bar/notification panel after notification button click
Use the following two code line to collapse the notification bar.
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);context.sendBroadcast(it);
Ok I've found the solution. It's not public API, but it works (for the moment):
Object sbservice = c.getSystemService( "statusbar" ); Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" ); Method hidesb = statusbarManager.getMethod( "collapse" ); hidesb.invoke( sbservice );
For this to work
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>
is needed