PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Managing locks
  • Retrieved properties
  • Operating mode in iPhone/iPad
  • Required permissions
  • Required application feature
  • Browsers allowing the geo-localization
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Retrieves information about the current device position.
Versions 16 and later
WEBDEV - Browser code This function is now available in Browser code.
New in version 16
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code This function is now available in Browser code.
Versions 17 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App GPSGetPosition must be run in a thread.
New in version 17
Universal Windows 10 App This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App GPSGetPosition must be run in a thread.
Universal Windows 10 App This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App GPSGetPosition must be run in a thread.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 22 and later
WINDEVWindows This function is now available for the WINDEV applications.
New in version 22
WINDEVWindows This function is now available for the WINDEV applications.
WINDEVWindows This function is now available for the WINDEV applications.
Example
MyPosition is geoPosition
MyPosition = GPSGetPosition()
// Checks the position validity with ErrorOccurred
IF ErrorOccurred THEN RETURN
Info(" Latitude : " + MyPosition..Latitude) 
Info(" Longitude : " + MyPosition..Longitude)
Versions 16 and later
WEBDEV - Browser code
// Geo-localization from WEBDEV, a browser procedure is called.
// Process performed from a button whose action is "none"
GPSGetPosition(BrowserProc, 200)
// "BrowserProc" browser procedure
PROCÉDURE BrowserProc(MyPosition is geoPosition, nMyError is int)

SWITCH nMyError

CASE gpsErrorOK
// No error was detected
PAGE_Page1.EDT_NoName1 = MyPosition..Altitude + " " + ...
MyPosition..Longitude
CASE gpsErrorRights
PAGE_Page1.EDT_NoName1 =  ...
"The browser has no sufficient rights " + ...
"to use the geo-localization (or non-HTTPS site)."
CASE gpsErrorPosition
PAGE_Page1.EDT_NoName1 = "Unable to define the position " + ...
"(internal error of provider for example)."
CASE gpsErrorTimeout
PAGE_Page1.EDT_NoName1 =  ...
"The position was not retrieved " + ...
" within the alloted time."
OTHER CASE
PAGE_Page1.EDT_NoName1 = "Undefined error"
END
New in version 16
WEBDEV - Browser code
// Geo-localization from WEBDEV, a browser procedure is called.
// Process performed from a button whose action is "none"
GPSGetPosition(BrowserProc, 200)
// "BrowserProc" browser procedure
PROCÉDURE BrowserProc(MyPosition is geoPosition, nMyError is int)

SWITCH nMyError

CASE gpsErrorOK
// No error was detected
PAGE_Page1.EDT_NoName1 = MyPosition..Altitude + " " + ...
MyPosition..Longitude
CASE gpsErrorRights
PAGE_Page1.EDT_NoName1 =  ...
"The browser has no sufficient rights " + ...
"to use the geo-localization (or non-HTTPS site)."
CASE gpsErrorPosition
PAGE_Page1.EDT_NoName1 = "Unable to define the position " + ...
"(internal error of provider for example)."
CASE gpsErrorTimeout
PAGE_Page1.EDT_NoName1 =  ...
"The position was not retrieved " + ...
" within the alloted time."
OTHER CASE
PAGE_Page1.EDT_NoName1 = "Undefined error"
END
WEBDEV - Browser code
// Geo-localization from WEBDEV, a browser procedure is called.
// Process performed from a button whose action is "none"
GPSGetPosition(BrowserProc, 200)
// "BrowserProc" browser procedure
PROCÉDURE BrowserProc(MyPosition is geoPosition, nMyError is int)

SWITCH nMyError

CASE gpsErrorOK
// No error was detected
PAGE_Page1.EDT_NoName1 = MyPosition..Altitude + " " + ...
MyPosition..Longitude
CASE gpsErrorRights
PAGE_Page1.EDT_NoName1 =  ...
"The browser has no sufficient rights " + ...
"to use the geo-localization (or non-HTTPS site)."
CASE gpsErrorPosition
PAGE_Page1.EDT_NoName1 = "Unable to define the position " + ...
"(internal error of provider for example)."
CASE gpsErrorTimeout
PAGE_Page1.EDT_NoName1 =  ...
"The position was not retrieved " + ...
" within the alloted time."
OTHER CASE
PAGE_Page1.EDT_NoName1 = "Undefined error"
END
Syntax
WINDEVAndroidAndroid Widget iPhone/iPadUniversal Windows 10 App

Retrieving information about a device (mobile, ...) Hide the details

<Result> = GPSGetPosition([<Time-out> [, <Message>]])
<Result>: geoPosition variable
geoPosition variable containing information about the device position. If the position is invalid, the ErrorOccurred variable is set to True and the error details are returned by ErrorInfo.
Android The ..PositionValid property of geoPosition type is used to find out whether the position is valid.
<Time-out>: Optional integer or optional Duration
Maximum time-out (in hundredths of a second) for updating the device position.
  • An error occurs if the time-out ends before the position of the device is updated. This error can be detected by the ErrorOccurred variable and the error details can be returned by ErrorInfo.
  • If this parameter is not specified, the time-out is set to 1 minute.
Note: This parameter can correspond to:
  • an integer corresponding to the number of hundredths of a second,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
<Message>: Optional character string (with quotes)
Message of hourglass displayed when updating the position.
Note: This parameter is taken into account only if the call is performed in the main application thread.
WINDEVUniversal Windows 10 App This parameter is ignored.
WEBDEV - Browser code

Retrieving the information in browser code Hide the details

GPSGetPosition([<Procedure Name> [, <Time-out>]])
<Procedure Name>: Character string (with or without quotes)
Name of WLanguage procedure in browser code ("callback") called when the position is retrieved.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Position>,<Error>)
where:
  • <Error> is an Integer constant corresponding to the error code and that can take the following values:
    gpsErrorOKNo error was detected.
    gpsErrorRights
    • The browser has no sufficient rights to use the geo-localization.
    • The browser is recent and the site is not using the HTTPS secure protocol.
    gpsErrorPositionUnable to define the position (internal error of provider for example).
    gpsErrorTimeoutThe position was not retrieved within the time-out.
<Time-out>: Optional integer or optional Duration
Maximum time-out (in hundredths of a second) for updating the device position.
  • If this time-out ends before the device position is updated, gpsErrorTimeOut is returned in the <Error> parameter of WLanguage procedure.
  • If this parameter is not specified, the time-out is set to 1 minute.
Note: This parameter can correspond to:
  • an integer corresponding to the number of hundredths of a second,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
Remarks

Managing locks

GPSGetPosition is a locking function until the current device position was retrieved or until the time-out defined by the <Time-out> parameter has expired.
If the function is called in the main thread of the application, an hourglass will be displayed during the function execution. The message displayed by the hourglass can be specified via the <Message> parameter.
Otherwise, the execution of secondary thread will be locked during the function execution and no hourglass will be displayed.
WEBDEV - Browser code This function is not locking.
Note: To find out the last know device position without time-out, use GPSLastPosition. Caution, the positioning information that was retrieved may not correspond to the current device position if the device was moved while the GPS signal was not valid for example. To find out the date and time at which the position was calculated, use the ..MeasurementDate property of the geoPosition variable.
AndroidAndroid Widget iPhone/iPadUniversal Windows 10 App

Retrieved properties

Versions 17 and later
iPhone/iPad

Operating mode in iPhone/iPad

During the first startup of a GPS function, the system asks the user for the authorization to perform a geo-localization. If the user refuses, all the GPS functions used in the rest of the application will fail (fatal error).
To re-allow the use of GPS for this application, the system configuration of the application must be modified.
New in version 17
iPhone/iPad

Operating mode in iPhone/iPad

During the first startup of a GPS function, the system asks the user for the authorization to perform a geo-localization. If the user refuses, all the GPS functions used in the rest of the application will fail (fatal error).
To re-allow the use of GPS for this application, the system configuration of the application must be modified.
iPhone/iPad

Operating mode in iPhone/iPad

During the first startup of a GPS function, the system asks the user for the authorization to perform a geo-localization. If the user refuses, all the GPS functions used in the rest of the application will fail (fatal error).
To re-allow the use of GPS for this application, the system configuration of the application must be modified.
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission: ACCESS_FINE_LOCATION.
Versions 21 and later
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Geo-localization
This feature allows the applications to access the geo-localization features found on the device or on the computer.
New in version 21
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Geo-localization
This feature allows the applications to access the geo-localization features found on the device or on the computer.
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Geo-localization
This feature allows the applications to access the geo-localization features found on the device or on the computer.
WEBDEV - Browser code

Browsers allowing the geo-localization

Caution: The geo-localization is available for the most recent browsers only:
  • 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 geo-localization function, the browser requests the authorization to localize.
Note: From Chrome 50 (including on Android), GPSGetPosition 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.
Components
WINDEV wd230java.dll
WEBDEV - Browser code WDJS.DLL
Android wd230android.jar
Minimum required version
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment