ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Geolocation functions
  • Special cases
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the information about the location provider used by the application for geolocation functions.
Example
AndroidAndroid Widget
// Test du type de fournisseur utilisé
IF GPSInfo(gpsType) = gpsSatellite THEN
	Info("La géolocalisation du téléphone utilise le système GPS.")
END
IF GPSInfo(gpsSpeed) = False THEN
	Error("La vitesse de déplacement du téléphone ne peut pas être déterminée.")
END
Syntax
<Result> = GPSInfo(<Information>)
<Result>: Variant
Requested information according to <Information>.
<Information>: Integer constant
Type of information requested.
gpsAltitudeAltitude of available device.<Result> will correspond to:
  • True if the location provider can be used to define the device altitude,
  • False otherwise or if no location provider was found.
gpsDirectionDirection of the move performed by the device.<Result> will correspond to:
  • True if the location provider can be used to define the direction of the move performed by the device,
  • False otherwise or if no location provider was found.
gpsEnergyEnergy consumption required by the provider.<Result> will correspond to:
  • gpsLowEnergy: The supplier must require a low amount of energy.
  • gpsAverageEnergy: The supplier can request an average amount of energy.
  • gpsHighEnergy: The supplier may require a high amount of energy.
gpsPrecisionPrecision of the position measurement performed by the provider.<Result> will correspond to:
  • gpsHigh precision: position calculation with high precision.
  • gpsLow precision: position calculation with low precision.
gpsSpeedSpeed of the move performed by the device.<Result> will correspond to:
  • True if the location provider can be used to define the speed of the move performed by the device,
  • False otherwise or if no location provider was found.
gpsTypeType of location provider.<Result> will correspond to:
  • gpsSatellite: GPS satellite network location provider.
  • gpsNetwork: location provider using mobile antennas or Wi-Fi.
  • 0 if the type of location provider was not defined.
WINDEV This constant is not available.
Remarks

Special cases

  • It is recommended to initialize the location provider settings with GPSInitParameter before retrieving information from that provider.
  • The activation status of the location provider is returned by GPSStatus.
AndroidAndroid Widget

Required permissions

This function changes the permissions required by the application.
Permission required: 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 PROCEDURE Callback(p is Permission)
    	IF p.Accordé THEN
    		// Utilisation possible des fonctions nécessitant la localisation en arrière-plan
    	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.
Component: wd300java.dll
Minimum version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help