当我尝试在TimerTask
(在Service
内部创建)中获取默认的蓝牙适配器,而不是在Activity
中时,我可以使用以下代码:
BluetoothAdapter.getDefaultAdapter();
我遇到了以下异常:
Exception while invoking java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
我的应用程序没有任何活动 - 那么有可能将此适配器从活动中移除吗?