我知道可以通过反射来扩展通知栏
Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" );
Method showsb;
if (Build.VERSION.SDK_INT >= 17) {
showsb = statusbarManager.getMethod("expandNotificationsPanel");
}
else {
showsb = statusbarManager.getMethod("expand");
}
showsb.invoke( getSystemService( "statusbar" ) );
然而,如果它被折叠了,有没有一种方法可以将其展开,如果已经展开,则将其折叠?
在Android文档中,StatusBarManager有一个切换功能,但对我不起作用。
编辑:
我正在从绑定服务内调用此函数。