且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何下拉状态栏编程机器人

更新时间:2023-11-19 12:30:22

在任何地方使用该code。

Use this code anywhere.

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

还是要使它更短的使用这样的:

Or to make it more short use this :

StatusBarManager statusBar = (StatusBarManager) getSystemService(STATUS_BAR_SERVICE);
statusBar.expand();

权限是必需的清单中。

Permission is required in manifest.

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