I am getting a GattCallback error: 133 when writing data to the device.It happens, the app is in the background mode or killed state.
using (IDevice _device = await adapter.ConnectToKnownDeviceAsync(deviceID, new ConnectParameters(false, false), cancellationToken: _cancellationTokenSource.Token))
{
_cancellationTokenSource = new CancellationTokenSource();
_cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30));
// TestingValue("49");
using (IService _service = await _device.GetServiceAsync(Guid.Parse("00008592-0000-1000-8000-00805f7b45fg"), _cancellationTokenSource.Token))
{
if (_service != null)
{
ICharacteristic _characteristic =
await _service.GetCharacteristicAsync(Guid.Parse("00002a06-0000-1000-8000-00805f7b45fg"));
if (_characteristic != null)
{
_characteristic.WriteType = CharacteristicWriteType.WithoutResponse;
_cancellationTokenSource = new CancellationTokenSource();
_cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30));
await _characteristic.WriteAsync(data, _cancellationTokenSource.Token);
await Task.Delay(3000);
}
}
}
I want to make sound in my ble device when choosing an option or when a notification comes in the app.It works perfectly in some devices.But in some devices I got a 133 Gatt error when the app is in the background mode and killed state after that it doesn't work in all the state.
Please help me...