question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cant notify my device on propertie is Indicate Android 10

See original GitHub issue

I have some problems to use Plugin.BLE on Android 10. I can’t await characterist.StartUpdateAsync(). All time when I call this method my code skip the rest. My characterist has propertie Indicate.

My code: ` await adapter.StopScanningForDevicesAsync(); //await adapter.DisconnectDeviceAsync(device); await adapter.ConnectToDeviceAsync(device);

                var services = await device.GetServicesAsync();
                
                ICharacteristic characteristicTemperature = null;
                ICharacteristic characteristicBattery = null;

                foreach (var service in services)
                {
                    var caracteristicas = await service.GetCharacteristicsAsync();


                    foreach (var carac in caracteristicas)
                    {
                        
                        var descritors = await carac.GetDescriptorsAsync();

                        //Bug android 9 ou > -- Problemas ao notificar o device
                        //Checa se é Bateria ou Temperatura
                        if (carac.Uuid == "2a19" || carac.Uuid == "2a1c"
                            || carac.Name.ToLower().Equals("temperature measurement")
                            || carac.Name.ToLower().Equals("battery level"))
                        {

                            if (carac.Name.ToLower().Equals("battery level") || carac.Uuid == "2a19")
                            {
                                characteristicBattery = carac;
                            }

                            if (carac.Name.ToLower().Equals("temperature measurement") || carac.Uuid == "2a1c")
                            {
                                characteristicTemperature = carac;
                            }

                        }
                    }
                }


                if (characteristicTemperature.CanUpdate)
                {


                    var descriptor = await characteristicTemperature.GetDescriptorsAsync();

                    characteristicTemperature.ValueUpdated += (o, args) =>
                    {
                        byte[] bytes = args.Characteristic.Value;
                    };

                    await characteristicTemperature.StartUpdatesAsync();

                }`

In iOS and Android 8 or bottom this method runs ok.

Steps to reproduce

  1. Conect to device find service and characterist

  2. Try run await characterist.StartUpdateAsync()

Expected behavior

Continue rest of code and get value from device.

Actual behavior

Skip rest of code and don’t notify device.

Crashlog

[BluetoothGatt] discoverServices() - device: E1:EB:0A:09:B9:21 [BluetoothGatt] onConnectionUpdated() - Device=E1:EB:0A:09:B9:21 interval=6 latency=0 timeout=500 status=0 [BluetoothGatt] onSearchComplete() = Device=E1:EB:0A:09:B9:21 Status=0 [Mono] DllImport searching in: ‘__Internal’ (‘(null)’). [Mono] Searching for ‘java_interop_jnienv_call_int_method’. [Mono] Probing ‘java_interop_jnienv_call_int_method’. [Mono] Found as ‘java_interop_jnienv_call_int_method’.

Configuration

Version of the Plugin: 2.1.1

Platform: Android 10

Device: Samsung A20

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
MelissaW990commented, Oct 6, 2020

I have also encountered this issue and believe it is a problem with Android 10 on Samsung devices only. I found this forum which describes the issue in more detail, seems Samsung have been aware of the bug since the start of the year but no fix has been put in place yet. Really poor on their behalf! https://forum.developer.samsung.com/t/samsung-android-10-ble-connectivity-regression/509/92

0reactions
kvrscreamcommented, Feb 24, 2021

Hi everyone.

I found it a solution. I reset connection and bluetooth setting for my android device and the application work normality.

Thanks everyone for help me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control notifications on Android
On your phone, open the Settings app. · Tap Notifications and then Wireless emergency alerts. · Choose how often you want to receive...
Read more >
Android Notifications Not Showing Up? 10 Fixes You Can Try
Not seeing notifications show up on your Android phone? Try these fixes to get Android notifications working again.
Read more >
Notification runtime permission
If a user installs your app on a device that runs Android 13 or higher, your app's notifications are off by default. Your...
Read more >
Android notification is not showing
Notifications may not be shown if you show the notifications rapidly one after the other or cancel an existing one, then right away...
Read more >
Troubleshooting notifications in the Phone Link app
My notifications have stopped syncing · Go to Settings and search for Notification access. · Find Link to Windows in the list and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found