我正在调用以下方法以编程方式扩展状态栏,它适用于大多数设备,但它不适用于Samsung S6和其他三星设备。为什么?如何在这些设备中以编程方式扩展状态栏?
public static void expandStatusBar() {
try {
Object statusBarService = MBApplication.getContext().getSystemService(NAME_STATUS_BAR_SERVICE);
Class<?> statusBarManager = Class.forName("android.app.StatusBarManager");
Method expandMethod;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
expandMethod = statusBarManager.getMethod("expandNotificationsPanel");
} else {
expandMethod = statusBarManager.getMethod("expand");
}
expandMethod.invoke(statusBarService);
} catch (Exception e) {
e.printStackTrace();
}
}