There are examples in the forum of using the newer API with JavaObject.
I was very hopeful that I found solution, but not for long.
In your code there is a function:
Private Sub Scan_Result (Result As Object)
Log("Scan_Result")
Dim ScanResult As JavaObject = Result
Dim device As JavaObject = ScanResult.RunMethod("getDevice", Null)
Dim address As String = device.RunMethod("getAddress", Null)
ManagerJO.GetFieldJO("devices").RunMethod("put", Array(address, device))
Dim name As String
Dim o As Object = device.RunMethod("getName", Null)
If o = Null Then name = "" Else name = o
Dim ScanRecord As JavaObject = ScanResult.RunMethod("getScanRecord", Null)
Log(ScanRecord) 'you can extend the code to access the data.
'https://developer.android.com/reference/android/bluetooth/le/ScanRecord
Dim rssi As Double = ScanResult.RunMethod("getRssi", Null)
Manager_DeviceFound(name, address, CreateMap(), rssi)
End Sub
The last line is the call that supposed to provide Adevertising Data - Manager_DeviceFound(name, address, CreateMap(), rssi)
But is just gives an empty map - CreateMap()
The whole point of scanning was to get advertising data!
So, I follow the link provided in this function to get advertising data:
And information is:
First I search the forum for "
getAdvertisingDataMap". What I get is 7 pages of no results. How did the search engine come out with "Google Map" for a search term "
getAdvertisingDataMap"?
Then I call Dim data As Object = ScanRecord.RunMethod("getAdvertisingDataMap", Null)
The result is HashMap<integer, byte[]> -
{22=[B@28e36ed, 9=[B@397c922}
How to convert HashMap, or get data from HashMap with int value 22?
Searching the forum and trying different things gets me nowhere. Unfortunately, you created a Map object which is not compatible with Android Java HashMap!
I wasted another couple of hours.
No wonder that you put an empty map in the call Manager_DeviceFound(...)
Now you see that average forum user can't do much with this, and that updating/adding new features created by Google to the library would benefit all users