Home | Sign in | English EN
  • Necessary version
  • Bluetooth Low Energy
  • Required permissions
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Used to find the Beacons near the device.
// In a museum, we want to display on the visitor device the information
// regarding the masterpiece he is looking at. Associate to each Beacon
// the same UUID corresponding to the museum as well as Major and Minor numbers
// allowing each Beacon to be uniquely identified.
// A Beacon is placed next to each work of art in the museum.
// The application must call the BeaconDetectPrecise function with a
// BeaconGroup variable corresponding to the Beacons in the museum.
// The callback procedure passed in parameter to the function will be called whenever
// a new list of Beacons is detected. Then, all you have to do is find
// the nearest Beacon to identify the work the visitor is looking at and to display
// the corresponding information in the application.
// Museum UUID
sUUID is string = "f4231ab6-5ef2-6c99-4229-af6c72e0446e"
// Create a beaconGroup variable corresponding to the Beacons in the museum
groupMuseum is beaconGroup
groupMuseum..UUID = sUUID
// Start the detection
BeaconDetectPrecise(groupMuseum, ProcDetection)
INTERNAL PROCEDURE ProcDetection(arrInfo is array of beaconDetectionInfo)
nMinDistance is int
NearestBeacon is beaconDetectionInfo
FOR EACH Information OF arrInfo
IF nMinDistance = 0 _OR_ Information..Distance < nMinDistance
NearestBeacon = Information
// Display information about the masterpiece associated with the Beacon
DisplayMasterpieceInfo(NearestBeacon..Major, NearestBeacon..Minor)
<Result> = BeaconDetectPrecise(<Group of Beacons> , <WLanguage procedure>)
<Result>: Boolean
  • True if the detection was started,
  • False otherwise. To get the details of the error, use ErrorInfo.
<Group of Beacons>: beaconGroup variable
Name the of beaconGroup variable that describes the searched group of Beacons.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called when a new list of Beacons is detected.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Array of Detection Info>)
where <Array of detection info> is a beaconDetectionInfo variable that describes the information about the detected Beacons (identifiers, Major/Minor numbers, distance, etc.)
  • This function thoroughly studies Bluetooth emissions around the device to detect Beacons and to estimate how far they are. This study consumes a lot of energy: therefore, it is recommended to call this function only if there is at least one nearby Beacon.
    To do so, you can call BeaconDetectBackground then BeaconDetectPrecise from the callback procedure run when the application detected the entry in the Beacon transmission range.
    Furthermore, we advise you to stop the precise detection as soon as possible. BeaconStopPreciseDetection is used to stop the current detection: it can for example be called in the WLanguage procedure run when the application detects the exit from the transmission range of the beacons.
  • The precise detection of Beacons is performed only when the application is in the foreground. When the application goes into background, the detection is automatically suspended and it will resume as soon as the application goes back into foreground. The detection is permanently stopped when the application is stopped. To perform a detection in background, use BeaconDetectBackground.
  • iPhone/iPad When generating the application, you have the ability to allow the call to BeaconDetectPrecise when the application is in background ("Allow GPSFollowMovement and BeaconDetectPrecise to be called when the application is in background" in the "Configuration" step of wizard). In this case, the precise detection can continue when the application is in background or when the device is in stand-by mode. See Generating an iOS application for more details.
  • Several precise detections cannot be started at the same time. If BeaconDetectPrecise is called while a detection is already in progress, the current detection will be stopped and a new detection will be started.
AndroidAndroid Widget

Necessary version

Beacon management functions are available for devices running on Android 4.3 or later (api level 18).
A fatal error occurs if the function is used with an earlier system version.
To find out which version of Android the application is running on, use SysAndroidVersion.
AndroidAndroid Widget

Bluetooth Low Energy

The device must support the Bluetooth Low Energy technology (Bluetooth LE).
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission: ACCESS_COARSE_LOCATION : Allows the application to get the approximate device position.
Android 10 specific case: Android 10 has implemented a new permission for the functions that allow locating the device: ACCESS_BACKGROUND_PERMISSION.
This permission allows using the function when the application is in the background.
When this permission is added to the application, a window allows the user to:
  • allow access to the device location while the application is in the background,
  • allow access to the location only while the application is in use,
  • deny access to the location.
The user can also change these permissions at any time in the Android settings.
Component : wd260android.aar
Minimum version required
  • Version 23
Click [Add] to post a comment