0

我从 adw 启动器中找到了以下代码:

Object service = launcher.getSystemService("statusbar");
if (service != null) {
    Method expand = service.getClass().getMethod("expand");
    expand.invoke(service);
}

引发 SecurityException:StatusBarManagerService:用户 123456 和当前进程都没有 android.permission.EXPAND_STATUS_BAR

所以我加了

<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />

到我的应用程序 manifest.xml,但仍然没有运气

4

1 回答 1

1
Object service = getSystemService( "statusbar" );
Class<?> statusbarManager = Class.forName( "android.app.StatusBarManager" );
Method expand = statusbarManager.getMethod( "expand" );
expand.invoke( service );

并将其添加到清单中:

<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
于 2012-06-26T15:56:41.857 回答