AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de geolocalización
  • Special cases
  • Modo de funcionamiento en iPhone/iPad
  • Required permissions
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Initializes the parameters of geolocation WLanguage functions and finds a location provider.
To define the device position, you have the ability to use two types of "localization providers":
  • the network of GPS satellites.
  • the triangulation performed from the network of mobile and Wi-Fi antennas.
Each provider differs by the precision of its information, its energy consumption and the required hardware configuration (presence of a GPS chip, Internet access, etc.).
Ejemplo
AndroidWidget Android
// Find a location provider that can give information about the speed
// consuming an average amount of energy and providing a high level of precision
GPSInitParameter(gpsAuto, gpsPrecisionHigh + gpsSpeed + gpsEnergyMedium)
Sintaxis
GPSInitParameter(<Provider to find> [, <Options>])
<Provider to find>: Integer constant
Type of requested location provider.
gpsAutoDefines the most suitable provider according to the criteria specified in the <Options> parameter.
gpsNetworkCalculates the position by using the network of mobile or Wi-Fi antennas.
gpsSatelliteCalculates the position by using the network of GPS satellites.

WINDEViPhone/iPadIOS WidgetMac Catalyst This parameter is ignored.
<Options>: Optional combination of Integer constants
Selection criteria for the location provider.
AndroidWidget Android This parameter is used when <Provider to find> corresponds to the gpsAuto constant. In the other cases, <Options> is ignored.
The possible values are:
gpsAltitudeIndicates whether the provider must be able to specify the altitude of the device.
WINDEV This constant is not available.
gpsDirectionIndicates whether the provider must be able to specify the move direction of the device.
WINDEV This constant is not available.
gpsEnergyHighIndicates whether the provider can require a high quantity of energy.
WINDEV This constant is not available.
gpsEnergyLowIndicates whether the provider must require a low quantity of energy.
WINDEV This constant is not available.
gpsEnergyMediumIndicates whether the provider can require a medium quantity of energy.
WINDEV This constant is not available.
gpsPrecisionHighThe position is calculated with high accuracy.
gpsPrecisionLowThe position is calculated with low accuracy.
gpsSpeedIndicates whether the provider must be able to specify the moving speed.
WINDEV This constant is not available.

Remarks:
  • The gpsPrecisionxx constants are exclusive between themselves.
  • The gpsEnergyxx constants are exclusive between themselves.
  • No constant is required. If no constant is specified, the function will search for a location provider that consumes the least amount of energy with any precision and without any specific characteristics.
Observaciones

Special cases

  • AndroidWidget Android You can get the availability of a geolocation provider using GPSStatus.
  • AndroidWidget Android To get the characteristics of the location provider initialized by GPSInitParameter, use GPSInfo.
  • Depending on the type of device on which the application is started, there may be no provider corresponding to all the specified criteria (no GPS chip, no Internet access, ...).
    If no supplier matches the specified criteria, the criteria will be dropped one after the other until a valid supplier is found, in the following order: energy consumption, accuracy, direction, speed and z-order.
  • The geolocation functions can, according to the selected setting and to the call frequency, consume a lot of resources on the device (battery, bandwidth, etc.). GPSEnd must be called when the location functions are no longer used by the application.
  • If a geolocation function is called, but the parameters have not yet been defined by GPSInitParameter, the application will try to use the GPS location first and then the mobile antenna network if the GPS system is not available.
  • GPS functions don't allow you to geolocate "indoors": you can't position yourself using Wi-Fi terminals alone.
iPhone/iPadIOS WidgetMac Catalyst

Modo de funcionamiento en iPhone/iPad

Cuando se ejecuta por primera vez una función GPS, el sistema solicita permiso de geolocalización al usuario. Si el usuario se niega, todas las funciones GPS utilizadas en el resto de la aplicación fallarán (error fatal).
Para volver a permitir el uso del GPS en esta aplicación, es necesario modificar la configuración del sistema de la aplicación.
AndroidWidget Android

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.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.
Componente: wd300java.dll
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local