[英]android studio screen turn off / lock screen
当屏幕关闭时,我的扫描仪wifi也关闭。
如何使wifi扫描持续进行? 我本想打开和关闭屏幕以激活wifi扫描功能,但无法在服务中关闭屏幕
如何在服务中关闭屏幕或锁定屏幕?
谢谢
AndroidDevelopers
上有一个有关如何保持屏幕打开的示例
public class MyIntentService extends IntentService {
public static final int NOTIFICATION_ID = 1;
private NotificationManager mNotificationManager;
NotificationCompat.Builder builder;
public MyIntentService() {
super("MyIntentService");
}
@Override
protected void onHandleIntent(Intent intent) {
Bundle extras = intent.getExtras();
// Do the work that requires your app to keep the CPU running.
// ...
// Release the wake lock provided by the WakefulBroadcastReceiver.
MyWakefulReceiver.completeWakefulIntent(intent);
}
}
这里参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.