Android 如何在后台继续运行蓝牙
我有一个循环,可以无限期地保持蓝牙描述设备,你可以看到它有多么简单Android 如何在后台继续运行蓝牙,android,kotlin,bluetooth,screen,system,Android,Kotlin,Bluetooth,Screen,System,我有一个循环,可以无限期地保持蓝牙描述设备,你可以看到它有多么简单 thread { while(1==1){ if(!mBluetoothAdapter.isDiscovering){ mBluetoothAdapter.startDiscovery()
thread {
while(1==1){
if(!mBluetoothAdapter.isDiscovering){
mBluetoothAdapter.startDiscovery()
}
}
}
它工作得很好,但问题是当我关闭屏幕时,2分钟后威胁仍然存在,但出于某种原因,蓝牙停止发现设备
我的问题是:是否有任何方法可以模拟系统的屏幕仍然打开,即使您将其关闭