ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Geolocation functions
  • Browsers allowing the geolocation
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
Requests to be notified periodically of the device's current location.
Example
// Enables a procedure to receive the device's location at regular intervals
GPSFollowMovement(MovementProc)
// Procedure
PROCEDURE MovementProc(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
Caution: 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

Caution: Geolocation is only available on certain modern browsers:
  • FireFox from version 3.5,
  • Chrome from version 5.0.342.1,
  • Opera from version 10.6,
  • Safari from version 5.0.
During the call to a geolocation function, the browser requests a location authorization.Remark: From Chrome 50 (including on Android), GPSFollowMovement can only be used on the sites secured 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: wd290java.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: 06/23/2023

Send a report | Local help