Xamarin.Android Crash on BluetoothLeScanner.StartScan

RedRaRedRa Member ✭✭✭

During testing Bluetooth application, I have catch the following exception System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.' on call:

BluetoothLeScanner.StartScan

... It is very strange, and I even do not know where it is thrown ...

Have anyone faced with the same issue ?

Best Answer

  • RedRaRedRa ✭✭✭
    Accepted Answer

    Issue was that I forget to enable Bluetooth on my phone and also to request from user Location Api Permissions:

                var locationPermissions = new[]
                {
                    Manifest.Permission.AccessCoarseLocation,
                    Manifest.Permission.AccessFineLocation
                };
    

    After user confirmed providing Location Api Permissions, issues was resolved !!

Answers

  • RedRaRedRa Member ✭✭✭
    Accepted Answer

    Issue was that I forget to enable Bluetooth on my phone and also to request from user Location Api Permissions:

                var locationPermissions = new[]
                {
                    Manifest.Permission.AccessCoarseLocation,
                    Manifest.Permission.AccessFineLocation
                };
    

    After user confirmed providing Location Api Permissions, issues was resolved !!

Sign In or Register to comment.