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
  • Android 12 specific case
  • Browsers allowing the geolocation
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Requests to be notified periodically of the device's current location.
Example
// Branche une procédure pour recevoir régulièrement la position du périphérique
GPSFollowMovement(ProcDeplacement)
// Procédure
PROCEDURE ProcDeplacement(pos is geoPosition)

Info(" Latitude : " + pos.Latitude)  
Info(" Longitude : " + pos.Longitude)
Syntax
WEBDEV - Browser code

Enabling the notification mechanism in browser code Hide the details

GPSFollowMovement(<WLanguage procedure>)
<WLanguage procedure>: Procedure name
Name of WLanguage procedure called at each notification. This procedure has the following format:
PROCEDURE <Procedure name>(<Location>, <Error>)
where:
  • <Location> is a variable of type geoPosition that contains information about the device's location at the time of the notification. To determine if a value was assigned to the Speed, Accuracy, Direction or Altitude properties of a geoPosition variable when the location was retrieved, use the SpeedValid, AccuracyValid, DirectionValid and AltitudeValid properties.
  • <Error> is an Integer constant corresponding to the error code and that can take the following values:
    gpsErrorOKNo error was detected.
    gpsErrorPositionUnable to determine the location (e.g., access provider internal error).
    gpsErrorRightsThe browser has no sufficient rights to use geolocation.
    gpsErrorTimeoutThe location could not be retrieved within the timeout.

Disabling the notification mechanism

GPSFollowMovement()
Remarks

Android 12 specific case

To execute the procedure called by GPSFollowMovement when the application is in the background, it is necessary to run a persistent thread (ThreadPersistent).
WEBDEV - Browser code

Browsers allowing the geolocation

During the call to a geolocation function, the browser requests a location authorization.Note: As of Chrome 50 (including Android), the function GPSFollowMovement function can only be used on secure sites (via an SSL certificate, for example). If the site is not secured, the function returns a result that cannot be used. During the test in local (localhost), the function operates properly.
Related Examples:
Android GPS Android (WINDEV Mobile): Android GPS
[ + ] This example presents the use of the GPS functions of WLanguage in an Android application.
It is used to retrieve at regular interval:
- The latitude
- The longitude
- The altitude
- The speed
- The direction
WM Sports Cross-platform examples (WINDEV Mobile): WM Sports
[ + ] This example is a sport application used to save your performances.
The application calculates the distance, the time, the average speed and the number of calories spent according to the sport.
The run is displayed on a map control via markers and an itinerary.

The example also includes a server part used to synchronize the user data.
This webservice is available in the WEBDEV "WW_Sports" example.
Component: wd300java.dll
Minimum version required
  • Version 15
This page is also available for…
Comments
GPS Functions
https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/519-busca-endereco-rota-endereco-das-coordendas-523/read.awp?hl=enderecodascoordenadas

https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/2875-informatica-exemplo-google-maps-com-json-retornando-distancia/read.awp?lastview
BOLLER
10 Nov. 2018

Last update: 03/27/2025

Send a report | Local help