PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
New WINDEV Mobile 23 feature!
  • Using a service for mobile detection
  • How to identify the nearby tags?
  • Various
  • Necessary version
  • Required permissions
  • Specific features
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Allows the application to be notified when the device enters into or exits from an area corresponding to the emission radius of a set of Beacon tags.
Example
// In a museum, we want to trigger the reading (resp. the stop) of an audio guide
// when the visitor enters into (resp. exits from) a room.
// We associate to each Beacon tag the same UUID corresponding to the museum and
// a Major number corresponding to the room where the tag will be positioned.
// A Beacon tag is placed at each entrance of each museum room.
// The application must call the BeaconDetectBackground function
// with an array of BeaconGroup variables corresponding to each museum room.

// The callback procedure passed in parameter to the function will be called
// whenever entering into or exiting from a room and it will give information
// about the detected groupe of beacons in order to
// emulate the audio-guide to play the corresponding track.

// Museum UUID
sUUID is string = "f4231ab6-5ef2-6c99-4229-af6c72e0446e"
// Create a beaconGroup variable for each room
groupRoom1 is beaconGroup
groupRoom1..UUID = sUUID
groupRoom1..Major = 1
groupRoom2 is beaconGroup
groupRoom2..UUID = sUUID
groupRoom2..Major = 2
groupRoom3 is beaconGroup
groupRoom3..UUID = sUUID
groupRoom3..Major = 3
groupRoom4 is beaconGroup
groupRoom4..UUID = sUUID
groupRoom4..Major = 4
// Start the detection
arrBeaconGroup is array of beaconGroup = [groupRoom1, ...
   groupRoom2, groupRoom3, groupRoom4)
// The ProcDetection procedure will be run whenever the mobile enters into
// or exits from the area defined by each group of beacons.
BeaconDetectBackground(arrBeaconGroup, ProcDetection)
PROCÉDURE ProcDetection(Group is beaconGroup, nType is int)

IF nType = bdapLeave THEN
// Stop the current track
RETURN
END

IF nType = bdapEnter THEN
SWITCH Group..Major
CASE 1
// Read the track for room 1
CASE 2
// Read the track for room 2
...
END
END
Syntax

Starting a detection in background on several groups of Beacon tags Hide the details

<Result> = BeaconDetectBackground(<Array> , <Procedure Name>)
<Result>: Boolean
  • True if the detection was started,
  • False otherwise. To find out the error details, use ErrorInfo.
<Array>: Array of beaconGroup
Name of array of beaconGroup variables describing the groups of Beacon tags to detect.
<Procedure Name>: Character string (with or without quotes)
WLanguage procedure ("callback" procedure) called when the device enters into or exits from the emission area of a group of Beacon tags.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Group>, <Type>)
  • The <Group> parameter is a beaconGroup variable describing the group of Beacon tags for which the device entered into or exited from the emission area.
  • The <Type> parameter is an integer constant corresponding to one of the following values:
    bdbEnterThe device entered into the emission area of a group of Beacon tags.
    bdbLeaveThe device exited from the emission area of a group of Beacon tags.
Caution:
  • This procedure must be a global procedure of project. Otherwise, a fatal error will occur during the call to the function.
  • This procedure must not access the application interface. Indeed, as the procedure can be called in background, the windows are not necessarily opened.

Starting a detection in background on a group of Beacon tags Hide the details

<Result> = BeaconDetectBackground(<Group of Tags> , <Procedure Name>)
<Result>: Boolean
  • True if the detection was started,
  • False otherwise. To find out the error details, use ErrorInfo.
<Group of Tags>: beaconGroup variable
Name of beaconGroup variable describing the group of Beacon tags to detect.
<Procedure Name>: Character string (with or without quotes)
WLanguage procedure ("callback" procedure) called when the device enters into or exits from the emission area of a group of Beacon tags.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Group>, <Type>)
  • The <Group> parameter is a beaconGroup variable describing the group of Beacon tags for which the device entered into or exited from the emission area.
  • The <Type> parameter is an integer constant corresponding to one of the following values:
    bdbEnterThe device entered into the emission area of a group of Beacon tags.
    bdbLeaveThe device exited from the emission area of a group of Beacon tags.
Caution:
  • This procedure must be a global procedure of project. Otherwise, a fatal error will occur during the call to the function.
  • This procedure must not access the application interface. Indeed, as the procedure can be called in background, the windows are not necessarily opened.
Remarks

Using a service for mobile detection

BeaconDetectBackground enables a service for mobile detection that is not linked to WINDEV Mobile. When this service is enabled, it is paused and it only detects the entries and exits into/from areas.
Caution: To reduce the consumption of device battery, the search for tags found nearby the device is performed periodically with time intervals up to several minutes. Therefore, there may be some time between the moment the device enters into (or exits from) the emission radius of a group of Beacon tags and the effective notification of application.
To stop the service for mobile detection, you must:
Caution: Closing and re-running the application has no effect on the operating mode of service for mobile detection.

How to identify the nearby tags?

The detection of beacon tags performed by BeaconDetectBackground is independent of the application lifespan (this detection is performed by a service of mobile device that is not linked to WINDEV Mobile).
  • If the application is in background, it will continue to receive the entry and exit notifications.
  • If the application is stopped then restarted in the same area, no notification will be done. You must exit from the area to receive en exit notification. Similarly, you must enter into the area to receive an entry notification.
  • If the application is stopped, it will be automatically started when detecting a group of Beacon tags. In this case, the following processes are run:
    • initialization code of project,
    • WLanguage procedure ("callback" procedure) passed in parameter to BeaconDetectBackground.
    The first application window will not be opened.
Several solutions can be used to find out the precise list of beacon tags found nearby the device as well as their distance:
  • Call BeaconDetectPrecise. This function consumes a lot of energy and to save the device battery, we advise you to call it:
    • in the WLanguage procedure (callback procedure) of BeaconDetectBackground.
    • when starting the application.
    • in the process for moving the application in the foreground.
  • Store the area where the device is found via the WLanguage procedure of BeaconDetectBackground. This storage can be performed in a file.

Various

  • The active detections can be listed by BeaconListBackgroundDetection.
  • If a group of tags with the same information (UUID, major, minor) is added several times into the list of active detections, only the last addition will be taken into account.
AndroidAndroid Widget

Necessary version

The functions for managing Beacon tags are available for the devices running an Android version greater than or equal to version 4.3 (api level 18).
A fatal error will occur if the function is used with an earlier system version.
To find out the version of Android system on which the application is run, use SysAndroidVersion.
AndroidAndroid Widget 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.
iPhone/iPad

Specific features

  • You have the ability to detect up to 20 groups. An error will occur if the total number of groups to detect exceeds this number.
  • A network access is required in order for the detection to operate properly.
  • If the application was started in background, it is important not to perform long processes in the WLanguage procedure (callback procedure). Indeed, the iOS system automatically ends the execution of application after ten seconds.
  • The call to this function modifies the permissions required by the application.
    Required permissions:
    • Location Always Usage Description
    • Location When In Use Usage Description
    • Location Always And When In Use Usage Description.
Components
Android wd230android.jar
Minimum required version
  • Version 23
Comments
Click [Add] to post a comment