Clear Bluetooth cache on Android 7.0
<p>I am using a BLE 112 as peripheral and android and iphones phones as centrals, as the central almost never connects to the same peripherals I would like to reset the Bluetooth cache during each connection. I have added the service changed characteristic in the peripheral (service: 1801, characteristic: 2A05), and when indication is set on it, it indicates to delete the cache. On iphone it works fine, core Bluetooth does all the work. In Android sdk 19 – 23, I find the characteristic and set indication on it and it works:</p>

<pre><code>public static UUID GENERIC_ATTRIBUTE_SERVICE_UUID = UUID.fromString("00001801-0000-1000-8000-00805F9B34FB");
public static UUID SERVICE_CHANGED_UUID = UUID.fromString("00002A05-0000-1000-8000-00805F9B34FB");
public static UUID STATE_DESCRIPTOR_UUID = UUID.fromString("00002902-0000-1000-8000-00805F9B34FB");


final BluetoothGattCharacteristic stateCharacteristic = mGatt
                                .getService(GENERIC_ATTRIBUTE_SERVICE_UUID)
                                .getCharacteristic(SERVICE_CHANGED_UUID);
if (!mGatt.setCharacteristicNotification(stateCharacteristic, true)) {                                
    gatt.discoverServices();
    return;
}
BluetoothGattDescriptor descriptor = stateCharacteristic.getDescriptor(Constants.STATE_DESCRIPTOR_UUID);
descriptor.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE);
mGatt.writeDescriptor(descriptor);
</code></pre>

<p>In Android sdk 24 the indication is automatically enabled, but when I send the indication from the peripheral the communication stops. I have tried to delay sending the indication, but the communication still stops.</p>

<p>What have changed, how do you clear the Bluetooth cache in android sdk 24 using the service changed characteristic?</p>