How to close the status bar/notification panel after notification button click

前端 未结 2 672
逝去的感伤
逝去的感伤 2020-12-05 02:17

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

2条回答
  •  隐瞒了意图╮
    2020-12-05 03:17

    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

    
    

    is needed

提交回复
热议问题