IDevice.ReadRssi() throws NullReferenceException
See original GitHub issueI am playing around with the plugin a bit and ran into this issue with calling ReadRssi() on an IDevice instance.
What I am doing is basically, scan for devices, select one of them and show details about it.
On that selected IDevice instance I do:
_device?.ReadRssi();
This throws the following exception:
05-04 10:43:20.080 E/mono-rt (20530): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
05-04 10:43:20.080 E/mono-rt (20530): at MvvmCross.Plugins.BLE.Droid.Bluetooth.LE.Device.ReadRssi () [0x00000] in c:\Users\sead\Documents\GitHub\MvvmCross-BluetoothLE\Source\MvvmCross.Plugins.BLE.Droid\Bluetooth\LE\Device.cs:264
05-04 10:43:20.080 E/mono-rt (20530): at com.bksv.ems.sxuble.ViewModels.DeviceDetailsViewModel.StartData () [0x00031] in C:\Users\Tomasz\Documents\Visual Studio 2015\Projects\SXUBLE\SXUBLE\ViewModels\DeviceDetailsViewModel.cs:90
05-04 10:43:20.080 E/mono-rt (20530): at com.bksv.ems.sxuble.droid.Views.DeviceDetailsView.OnResume () [0x00008] in C:\Users\Tomasz\Documents\Visual Studio 2015\Projects\SXUBLE\SXUBLE.Droid\Views\DeviceDetailsView.cs:22
05-04 10:43:20.080 E/mono-rt (20530): at Android.App.Activity.n_OnResume (IntPtr jnienv, IntPtr native__this) [0x00009] in /Users/builder/data/lanes/2923/b4be22e9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:3920
05-04 10:43:20.080 E/mono-rt (20530): at (wrapper dynamic-method) System.Object:ec6c167c-6312-4270-86db-3b0ff9ed091e (intptr,intptr)
Looking at the line it throws at: https://github.com/xabre/xamarin-bluetooth-le/blob/master/Source/MvvmCross.Plugins.BLE.Droid/Bluetooth/LE/Device.cs#L264 it could seem like the _gattCallback
is null for some reason.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
IDevice.ReadRssi() throws NullReferenceException #35
I am playing around with the plugin a bit and ran into this issue with calling ReadRssi() on an IDevice instance.
Read more >Android returning "null" for Bluetooth RSSI
After hitting the scan button to discover nearby devices it returns the device name, device address, and is also suppose to return the...
Read more >Nrf Connect SDK peripheral always reads RSSI as 127 ...
Hello, I'm using an nRF5340 board with nRF Connect SDK as a BLE peripheral device, and I'm trying to get RSSI value when...
Read more >BLE scan for RSSI for bluetooth paired devices : r/androiddev
Is there a way to scan nearby devices and get RSSI values for my paired devices without connecting to them ... getName() +...
Read more >Java Examples & Tutorials of Intent.getShortExtra (android. ...
makeText(getApplicationContext()," RSSI: " + rssi + "dBm", Toast.LENGTH_SHORT).show(); } } }; ... Android RSSI value of Bluetooth returns -32768 always?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I guess XML docs would be a good place to document this. Or a small wiki walking this through.
Yes, it is good now 👍