0

I have a project, where I use Plug-In Xabre for Bluetooth LE. To test it I use Android 7.0 device. The problem occurs when I start scanning for devices nearby.

Following is my code for scanning devices: deviceList.Clear();

        status = "SCANNING";

        adapter.DeviceDiscovered += (s, a) =>
        {
            deviceList.Add(a.Device);
        };
        if (!ble.Adapter.IsScanning)
        {
            await adapter.StartScanningForDevicesAsync();
        } 

Last night I could get the scanned device. But since then it can't scan anymore. On the Output Line in visual studio:

  • D/BluetoothLeScanner( 8436): could not find callback wrapper

But, when I tried it with a Android 4.4 Device, it works like what I am expecting, it can scan devices nearby.

Anyone know what is the problem here?

ptd
  • 29
  • 9
  • https://stackoverflow.com/a/41149864/4984832 – SushiHangover Feb 27 '18 at 13:42
  • @SushiHangover the first answer told me to ignore it, but if I ignore it I can't scan anything. And I have the Location Service turned on – ptd Feb 27 '18 at 14:11
  • Is the location services turned on at your App level? i.e. Are you requesting runtime access from the user? https://blog.xamarin.com/requesting-runtime-permissions-in-android-marshmallow/ – SushiHangover Feb 27 '18 at 14:20
  • @SushiHangover in which file should I wrie the code manifest.permission... ? – ptd Feb 27 '18 at 14:33
  • You should take a look at : https://github.com/jamesmontemagno/PermissionsPlugin – SushiHangover Feb 27 '18 at 14:35
  • @SushiHangover I will take a look on it. But I did create another app to test only the bluetooth function, and without implementing the method from that xamarin blog, it works. – ptd Feb 27 '18 at 14:53

0 Answers0