I\'ve browsed through Stackoverflow and have seen that this question has been asked, but I didn\'t find any solution.
I have a custom notification with 2 buttons. I
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
Use the following two code line to collapse the notification bar.
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.sendBroadcast(it);