Even if AndroidManifest contains uses-feature requirement for Bluetooth it is still possible to manually install apk to device without Bluetooth. In my case I install app to Android emulator which doesn't have Bt.
Code without this fix causes infinitive loop:
MainActivity.onResume calls reconnect() if Bl is not connected
BluetoothUtilImpl.reconnect() try to start Bl enabling intent.
Intent fails and MainActivity.onResume is called. Loop begins again
Even if AndroidManifest contains
uses-feature
requirement for Bluetooth it is still possible to manually install apk to device without Bluetooth. In my case I install app to Android emulator which doesn't have Bt.Code without this fix causes infinitive loop:
MainActivity.onResume
callsreconnect()
if Bl is not connectedBluetoothUtilImpl.reconnect()
try to start Bl enabling intent.MainActivity.onResume
is called. Loop begins again