The nearest Bluetooth detection

AtillaBilgic

Member
Licensed User
Longtime User
Hi All,

We need to detect the nearest bluetooth transmitter within our application to trigger some events.

Any opinions and information is appreciated.

Thanks and Regards.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You will need to follow these steps:
1. Read the intent filters tutorial: Intent Filters - Intercepting SMS messages in the background
2. Add an intent filter that listens to: android.bluetooth.device.action.FOUND
3. The intent will include a field named android.bluetooth.device.extra.RSSI (if the data is available).
 
Upvote 0

kanaida

Active Member
Licensed User
Longtime User
I was trying to do this a while back, if i remember though I didn't manage to get that RSSI value after trying a few different things. The exact reason escapes my memory at the moment. It'd be interested if anyone got this to work as well.
 
Upvote 0

AtillaBilgic

Member
Licensed User
Longtime User
my Manifest file is as follows, please validate...

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: Manifest Editor
AddManifestText(
<uses-sdk android:minSdkVersion="4"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
AddPermission(android.bluetooth.device.action.FOUND)
AddReceiverText(s1,
<intent-filter>
<action android:name="android.bluetooth.device.extra.RSSI" />
</intent-filter>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
 
Upvote 0

AtillaBilgic

Member
Licensed User
Longtime User
Module: s1_br not found.


Manifest File :

AddPermission(android.bluetooth.device.action.FOUND)
AddReceiverText(s1,
<intent-filter>
<action android:name="android.bluetooth.device.action.FOUND" />
</intent-filter>)
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Next make the service names "s1" and in the Start sub check intent
 
Upvote 0
Top