Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.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_Kotlin_Bluetooth_Screen_System - Fatal编程技术网

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分钟后威胁仍然存在,但出于某种原因,蓝牙停止发现设备

我的问题是:是否有任何方法可以模拟系统的屏幕仍然打开,即使您将其关闭