jeudi 22 octobre 2015

How to detect whether Notifications Panel is expanded?

I found this way to expanded Notifications Panel

Object sbservice = getSystemService("statusbar");
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(sbservice);

After looking into source, I also found collapsePanels method to collapse the notification

But I cannot find any way to detect the notification panel status

Because I want to check whether it is opened or closed, and then decide I should open it or close it

How can I know this status?





Aucun commentaire:

Enregistrer un commentaire