I was working with a BLE device, which needs to set the device time during pairing. Writing to the time characteristic in any other time does not effectively set the time.
Currently I am using the Android OS's Bluetooth Manager for pairing. And the progress of pairing is notified to my app through broadcast intent.
public void onReceive(Context context, Intent intent) {
....
switch (action) {
case BluetoothDevice.ACTION_BOND_STATE_CHANGED:
if(state == BluetoothDevice.BOND_BONDED){
//Write to the Date-Time Characteristic
}
else if(state==BluetoothDevice.BOND_BONDING){
}
else if(state==BluetoothDevice.BONE_NONE){
}
....
}
...
}
My question is how to inject code to the position commented above to complete the Date-Time setting? Apparently, the Android OS Bluetooth Manager does not set the time during its entire pairing process. Does Android allow two applications (OS Bluetooth Manager and my application) write to the remote gatt within a single connection session?