Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 蓝牙服务器线程是否在待机状态下工作?_Android_Service_Bluetooth - Fatal编程技术网

Android 蓝牙服务器线程是否在待机状态下工作?

Android 蓝牙服务器线程是否在待机状态下工作?,android,service,bluetooth,Android,Service,Bluetooth,我有一个服务,我创建了一个类似AcceptThread的线程来接受传入的蓝牙连接。 当设备进入待机状态时,它会工作吗?我正在使用服务中的线程,虽然我没有使用蓝牙,但我认为这可以帮助您 当手机处于待机状态时,cpu将停止工作,因此任何其他线程/应用程序/服务也将停止 我使用PowerManager解决了这个问题,如下所示: PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerMana

我有一个服务,我创建了一个类似AcceptThread的线程来接受传入的蓝牙连接。
当设备进入待机状态时,它会工作吗?

我正在使用服务中的线程,虽然我没有使用蓝牙,但我认为这可以帮助您

当手机处于待机状态时,cpu将停止工作,因此任何其他线程/应用程序/服务也将停止

我使用PowerManager解决了这个问题,如下所示:

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
 PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
 wl.acquire();
   ..CPU will stay on during this section..
 wl.release();

希望这对你有帮助

我正在使用服务中的线程,虽然我没有使用蓝牙,但我认为这可以帮助您

当手机处于待机状态时,cpu将停止工作,因此任何其他线程/应用程序/服务也将停止

我使用PowerManager解决了这个问题,如下所示:

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
 PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
 wl.acquire();
   ..CPU will stay on during this section..
 wl.release();

希望这对你有帮助

hay attila..我也在寻找同样的..你有什么解决办法吗?当我们在主屏幕和任何其他设备想要与我们通信时,你是否在应用程序的后台使用服务类来通知我们…hay attila..我也在搜索相同的..你有什么解决方案吗?当我们在主屏幕和任何其他设备想要与我们通信时,您是否在应用程序的后台使用服务类进行通知。。。