[英]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.