P popeyes44 Member Apr 23, 2020 #1 Hi everycoders ;-), I try to realize an application for android (iOS in future surely) but have little difficulties. The idea is to discover phone in my family (using BLEManager library because using GPS is too bad on my test [few meters errors...]) which all have the program installed on. For do that I know I need to make them always discoverable : B4X: Copy Intent1.Initialize("BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE", "") Intent1.PutExtra("BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION",600) StartActivity(Intent1) and use that for found device B4X: Copy Sub BLuE1_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double) Log("Name= " & Name & ", ID= " & Id & ", RSSI= " & RSSI & ", AD= " & AdvertisingData) End Sub All is OK at this point but I need to limit (or calcul) distance between my phone and bluetooth search, so do you find it's possible and, if yes, how could I do that ? Or maybe I could estimate distance with bluetooth data but I don't know how ? Thanks all for helping
Hi everycoders ;-), I try to realize an application for android (iOS in future surely) but have little difficulties. The idea is to discover phone in my family (using BLEManager library because using GPS is too bad on my test [few meters errors...]) which all have the program installed on. For do that I know I need to make them always discoverable : B4X: Copy Intent1.Initialize("BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE", "") Intent1.PutExtra("BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION",600) StartActivity(Intent1) and use that for found device B4X: Copy Sub BLuE1_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double) Log("Name= " & Name & ", ID= " & Id & ", RSSI= " & RSSI & ", AD= " & AdvertisingData) End Sub All is OK at this point but I need to limit (or calcul) distance between my phone and bluetooth search, so do you find it's possible and, if yes, how could I do that ? Or maybe I could estimate distance with bluetooth data but I don't know how ? Thanks all for helping
Erel B4X founder Staff member Licensed User Longtime User Apr 23, 2020 #2 You are confusing classic Bluetooth and BLE. You can use BLEPeripheral to advertise some information and detect it with BLEManager. You can also calculate the distance however it will be very inaccurate. If the devices are connected to the same network then you can use UDP broadcasting to detect other devices. This will work better. Upvote 0
You are confusing classic Bluetooth and BLE. You can use BLEPeripheral to advertise some information and detect it with BLEManager. You can also calculate the distance however it will be very inaccurate. If the devices are connected to the same network then you can use UDP broadcasting to detect other devices. This will work better.
P popeyes44 Member Apr 23, 2020 #3 Thanks for your reply, I need accurate distance so I will work more on my project to find another method ! Upvote 0
Thanks for your reply, I need accurate distance so I will work more on my project to find another method !
Erel B4X founder Staff member Licensed User Longtime User Apr 23, 2020 #4 You will not get an accurate location indoors and I don't see how you can get an accurate distance between two regular devices. Upvote 0
You will not get an accurate location indoors and I don't see how you can get an accurate distance between two regular devices.