BluetoothAdapter.getDefaultAdapter() throwing RuntimeException while not in Activity
-
29-10-2019 - |
Frage
When I'm trying to get default bluetooth adapter while i'm NOT in Activity, but in TimerTask
(created inside Service
) by using:
BluetoothAdapter.getDefaultAdapter();
I get the following exception:
Exception while invoking java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
My application do not have any activity - so is there any possibility to get this adapter away from Activity?
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow