当屏幕关闭时,我的扫描仪wifi也关闭。
如何使wifi扫描持久化? 我本想打开和关闭屏幕以激活wifi扫描功能,但无法关闭服务中的屏幕
如何在服务中关闭屏幕或锁定屏幕?
谢谢
答案 0 :(得分:0)
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);
}
}
引用here