I'm developing a cross platform app and I'm trying to understand the steps for using the Xamarin Android native APIs in order to connect, discover services, read characteristics, etc. of a Bluetooth LE peripheral device.
I have not found any decent Xamarin examples so far explaining what is/is not required. The BLE example I found provided by Xamarin has been deprecated for a while, and many of the related questions I have found on here are currently unanswered. So far, this is my understanding:
After successfully scanning for devices,
1. Create a BluetoothGattCallback class and use it to override OnConnectionStateChange, OnServicesDiscovered, On CharacteristicRead, etc.
2. 4. Override OnReceive and register your broadcast receiver for the central device using RegisterReceiver ?
3. Use the ConnectGatt method to connect to the BLE peripheral device
4. Use DiscoverServices( ) to see if any services are being advertised by the peripheral
5. Pair to the device using CreateBond( ) ?
6. Read characteristic data, etc. ?
7. Use Disconnect( ) / Close( ) from the BluetoothGatt class & UnregisterReceiver when finished ?
If anyone has come across any updated examples (with no deprecated code and not using third party plugins), I would really appreciate it if you shared below. Or, if you could fill in the blanks for me with the steps I have listed above, I'd appreciate the help. Thanks!