ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Geolocation functions
  • Special cases
  • Required permissions
  • Required application feature
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Asks to be notified when the device gets close to a given location.
Example
// Enable the notification request
GPSDetectPosition(DetectionProc, 1.145258, 30.968745)
// Procedure called during the notification
PROCÉDURE DetectionProc(Enter is boolean)
IF Enter = True THEN
Info("You have reached your destination.")
END
Syntax
<Result> = GPSDetectPosition(<WLanguage procedure> , <Latitude> , <Longitude> [, <Radius> [, <Timeout>]])
<Result>: Integer
Detection identifier.
This identifier is used in the following cases:
  • to stop the notification mechanism. Simply pass this identifier as a parameter to GPSStopDetection.
  • to identify the location processed in the WLanguage procedure called (case where the same WLanguage procedure is used to process several locations).
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback" procedure) called when the device enters into or exits from the region delimited by the specified parameters.
For more details on this procedure, see Parameters of the procedure used by GPSDetectPosition.
<Latitude>: Real
Latitude of the proximity location.
<Longitude>: Real
Longitude of the proximity location.
<Radius>: Optional real
Radius (in meters), around the proximity location, from which the notification is to be generated.
If this parameter is not specified, the radius around the location will be set to 50 meters.
<Timeout>: Optional integer or optional Duration
Timeout (in hundredths of a second) of the proximity alert. This timeout starts from the call to the function.
  • No timeout will be defined if this parameter is set to -1 or if it is not specified.
  • If this timeout is specified, the notification mechanism will automatically stop at the end of the timeout.
This parameter can correspond to:
  • an integer corresponding to the number of hundredths of a second,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
Remarks

Special cases

  • To stop receiving notifications, use GPSEnd.
  • To stop detecting the proximity of a specific location;
    • return False in the associated WLanguage procedure,
    • use the GPSStopDetection function.
  • You can detect the proximity to multiple locations by calling GPSDetectPosition for each location. If the same procedure is called for several locations, it is possible to differentiate these locations in the WLanguage procedure with the <Detection identifier> parameter. This parameter corresponds to the result of GPSDetectPosition.
  • Location measurements can be more or less accurate depending on the parameters of the location provider. Therefore, it may happen that no notification is sent if the device briefly passes near the monitored area. Similarly, a notification may be received if the device comes very close to the monitored area without entering it.
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission: ACCESS_FINE_LOCATION.
Android 11 specific case: This function requires the ACCESS_BACKGROUND_LOCATION permission to access the device's location.
This permission allows using the function when the application is in the background.
If the application needs to use background location:
  • Manually add the "ACCESS_BACKGROUND_LOCATION" permission in the Android application generation wizard.
  • Explicitly request background location permission with PermissionRequest. For example:
    PermissionRequest(permBackgroundLocation, Callback)
    INTERNAL PROCÉDURE Callback(p is Permission)
    IF p.Granted THEN
    // Functions that require background location access can be used
    END
    END
A window allows users 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.

Remarks:
  • Follow Google's guidelines for applications that require background location access. For more details, see https://support.google.com/googleplay/android-developer/answer/9799150. If these conditions are not met (especially user information requirements), applications may not be accepted for publication on Google Play.
  • The background location permission should only be requested if the location permission has been granted. Otherwise, PermissionRequest will fail.
  • If the option chosen by the user for the background location access request is more restrictive than the option chosen for the location access request, the application will be automatically restarted.
  • On devices running Android 10 or earlier, if location permission has been granted to the application, the background location permission will be granted without displaying a window.
Universal Windows 10 App

Required application feature

When this function is used, an application feature is declared in the application generation wizard.
Required feature: Geolocation
This feature allows the applications to access the geolocation features found on the device or on the computer.
Business / UI classification: Business Logic
Component: wd290java.dll
Minimum version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help