Reputation: 5422
Sometimes I've got an dead object exception when trying use my BluetoothAdapter
. How can I check if it is already dead before use? Or should I recreate BluetoothAdapter
every time in onResume
for example?
I suppose the reason of that exception is crash of BluetoothManager
. As the result instances of BluetoothAdapter
and BluetoothGattServer
became dead objects and I can no longer use it. Please suggest me some work around this problem. Thanx.
Upvotes: 4
Views: 661
Reputation: 2897
Why not put a receiver on your BluetoothAdapter state actions and do your necessary controls such as for the ACTION_DISCOVERY_STARTED. If your Adapter is damaged somehow, try to gracefully clean up remaining stuff and just create a new Adapter.
Upvotes: 1