Hey Everyone,
I am having some troubles figuring out how to see if a specific bluetooth device is connected or not. I need to monitor the state of a bluetooth connection.
I will be running this in a service. The Activity will pair and connect with the spp device originally but then the service needs to know if the device is connected or is offline.
I have read some articles but don't know how to use the (intents and getextras) properly
Constant Value: "android.bluetooth.device.action.ACL_CONNECTED"
or
Constant Value: "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED"
Because i am using a SPP serial Connection using Astream. The service must know if the device is connected. If the device is connected then it can reopen the stream. but if the device disconnects it needs to know that so it can close the stream so it doesn't crash the astream.
I am having some troubles figuring out how to see if a specific bluetooth device is connected or not. I need to monitor the state of a bluetooth connection.
I will be running this in a service. The Activity will pair and connect with the spp device originally but then the service needs to know if the device is connected or is offline.
I have read some articles but don't know how to use the (intents and getextras) properly
Constant Value: "android.bluetooth.device.action.ACL_CONNECTED"
or
Constant Value: "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED"
Because i am using a SPP serial Connection using Astream. The service must know if the device is connected. If the device is connected then it can reopen the stream. but if the device disconnects it needs to know that so it can close the stream so it doesn't crash the astream.