PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Special cases
  • 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 the activation status of the geo-localization provider or asks to be notified when the status changes.
Versions 16 and later
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code Retrieves the activation status of the geo-localization provider.
New in version 16
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code Retrieves the activation status of the geo-localization provider.
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code Retrieves the activation status of the geo-localization provider.
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.
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 This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
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
// Checks the status of the GPS provider
IF GPSStatus() = gpsDisabled THEN
        Info("The geo-localization is not enabled.")
END
AndroidAndroid Widget iPhone/iPadUniversal Windows 10 App
// Branches a notification procedure if the status of the GPS is modified
GPSStatus(ProcGPSStatus)
// Procedure called whenever the status of the GPS is modified
PROCEDURE ProcGPSStatus(GPS_Status is int)

IF GPS_Status = gpsUnavailable THEN
Info(" The geo-localization is not available.")
END
Syntax

Retrieving the activation status of the provider Hide the details

<Result> = GPSStatus()
<Result>: Integer constant
Activation status of the localization provider. The following values can be returned:
gpsEnabledThe provider is enabled.
gpsDisabledThe provider is disabled.
gpsErrorError while retrieving the activation status of the provider. Use ErrorInfo to find out the error details.
WINDEVWEBDEV - Browser codeUniversal Windows 10 App This constant is not available.
WINDEVAndroidAndroid Widget iPhone/iPadUniversal Windows 10 App

Asking to be notified when the activation status changes Hide the details

GPSStatus(<Procedure Name>)
<Procedure Name>: Character string (with or without quotes)
WLanguage procedure ("callback" procedure) called for each notification.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Status>)
<Status> is an integer constant corresponding to the new status of the provider.
It can take the following values:
gpsEnabledThe provider was enabled by the user.
gpsDisabledThe provider was disabled by the user.
gpsAvailableThe provider is available.
gpsOffServiceThe provider is off service.
gpsUnavailableThe provider is temporarily unavailable.
Remarks

Special cases

  • AndroidAndroid Widget iPhone/iPad We advise you to initialize the parameters of the localization provider with GPSInitParameter before retrieving the status of this provider.
  • AndroidAndroid Widget iPhone/iPadUniversal Windows 10 App To stop receiving the notifications when the status changes, call GPSStatus while passing an empty string ("") in parameter or use GPSEnd.
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.
Related Examples:
WM Geo-localization Cross-platform examples (WINDEV Mobile): WM Geo-localization
[ + ] This example explains how to perform proximity searches with geolocalization:
- search around me
- search in a city, at a given address, or close to a specific address.
The results are displayed in a looper and in a map with markers.
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
Components
WINDEV wd230java.dll
WEBDEV - Browser code WDJS.DLL
Android wd230android.jar
Minimum required version
  • Version 15
This page is also available for…
Comments
EXAMPLE: GPS status and on / off GPS via Java
FONTE:

http://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/9-windev-mobile-verifica-gps-ligado-posicao/read.awp

---x---

Example 01:
#####################################################

Procedure GPS_VerificaStatus()

Retorno is string = ""

GloLatitude , GloLongitude is real = 0

GPSInitParameter(gpsSatellite,gpsPrecisionHigh)

// Recuperação da posição
Retorno is geoPosition = GPSGetPosition() // 2000 = Intervalo máxo,p de 20 segundos

GloLatitude = NumToString(Retorno..Latitude,"+-10.6f")
GloLongitude = NumToString(Retorno..Longitude,"+-10.6f")

Retorno = GloLatitude +"; "+ GloLongitude

IF GloLatitude = 0 AND GloLongitude = 0 OR GloLatitude = null AND GloLongitude = null
ToastDisplay("GPS Desligado!!!")
END

RESULT(Retorno )

---x---



Example 02:
#####################################################

//Java GPS_On

import android.app.Activity;
import java.lang.*;
import android.util.*;
import java.lang.Exception;
import android.util.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

PUBLIC static void GPS_On()
{
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", True);
getActiviteEnCours().sendBroadcast(intent);
}

---x---

//Java GPS_Off

import android.app.Activity;
import java.lang.*;
import android.util.*;
import java.lang.Exception;
import android.util.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

PUBLIC static void GPS_Off()
{
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", False);
getActiviteEnCours().sendBroadcast(intent);
}


---x---

OBS.:
You must enable these options in the Android Manifest XML Windev Mobile

A) Android.Permission.WRITE_SECURE_SETTINGS

B) Android.Permission.WRITE_SETTINGS

---x---



Example 03
#####################################################
Another way to test whether this off GPS:

// GLOBAL
GloGpsAtivado is boolean = False

//Open Window
Procedure GPS_Inicializar()

GPSInitParameter(gpsSatellite,gpsPrecisionHigh +gpsSpeed)

IF GPSStatus() <> gpsEnabled THEN

Popup("Para melhorar a precisão da sua localização, ative o seu GPS","L")

gloStatusGps = False

ELSE
ChangeGPSStatus(GPSStatus())
END

GPSStatus(ChangeGPSStatus)

---x---

//Procedure Global

Procedure ChangeGPSStatus(nStatus)
IF gnCurrentStatus = nStatus THEN
RETURN
END

gnCurrentStatus = nStatus

IF nStatus = gpsEnabled OR nStatus = gpsAvailable THEN

GPSFollowMovement(GetPosition,300)

END

SWITCH nStatus
CASE gpsEnabled
GloGpsAtivado = True // <------------- Ligado
CASE gpsDisabled
GloGpsAtivado = False // <------------- Desligado
gloStatusGps = False
CASE gpsOffService
CASE gpsUnavailable
CASE gpsAvailable
END

adrianoboller
Feb. 14 2015