ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Geolocation functions
  • Retrieved properties
  • Notes
  • 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
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
Universal Windows 10 App

Enabling the notification mechanism (in a mobile) Hide the details

GPSFollowMovement(<WLanguage procedure> [, <Timeout> [, <Distance>]])
<WLanguage procedure>: Procedure name
Name of WLanguage procedure called at each notification.
This procedure has the following format:
PROCEDURE <Procedure name>(<Location>)
<Location> is a variable of type geoPosition that contains information about the device's location at the time of the notification.
<Timeout>: Optional integer or optional Duration
Minimum timeout (in hundredths of a second) between two notifications. If this parameter is not specified, the minimum timeout will be set to 60 seconds.
Remark: This parameter can be:
  • 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).
Universal Windows 10 App This parameter is ignored.
<Distance>: Optional real
Minimum distance (in meters) between two notifications.
If this parameter is not specified, the minimum distance will be set to 5 meters.

Disabling the notification mechanism

GPSFollowMovement()
Remarks
Universal Windows 10 App

Retrieved properties

  • 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.
  • To reinitialize a geoPosition variable, use VariableReset.
  • The positioning information that was retrieved corresponds to the last known device location: therefore, they may not correspond to the current device location if the device was moved while the GPS signal was not valid for example. You can use the MeasurementDate property of the geoPosition variable to determine the date and time at which the position was calculated.
  • Speed, Accuracy, Direction and Altitude will be specified only if the location provider allows it (otherwise, these properties will take their default value).
Universal Windows 10 App

Notes

  • Geolocation functions can consume a lot of resources on the device (battery, bandwidth, etc.). Therefore, we advise you not de define very small values for the minimum time-out and for the minimum distance between two notifications.
  • To stop receiving notifications, call GPSFollowMovement without parameter or call GPSEnd.
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.
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).
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: 06/23/2023

Send a report | Local help