PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → GPS PROBLEM ON BACKGROUND
GPS PROBLEM ON BACKGROUND
Iniciado por PILAR, abr., 14 2021 10:53 AM - 2 respostas
Publicado em abril, 14 2021 - 10:53 AM
First of all sorry for my english.
I am working in an app that need to give the GPS of the user, even when the app is in background or close.
I have been trying several options but none of them are working.
The procedure is a call to the webservice, in which the info has to be passed a database and that it is updated, as I comment in quite simple, I have put in this procedure that the authomatic procedure is periodic execution when app is in background, and the procedure is as follows:

PROCEDURE posicionbackground()

dtData is DateTime
MyPosition is a geoPosition
MyPosition = GPSGetPosition()

IF gpsDisabled = True THEN
gsReport = "GPS Disabled"
dtData = SysDateTime()

ELSE IF gpsOffService = True THEN
gsReport = "GPS off service"
dtData = SysDateTime()

ELSE IF gpsUnavailable = True THEN
gsReport = "GPS Unavailable"
dtData = SysDateTime()

ELSE
gsReport = ""
dtData = ""
END

gsLatitude = MyPosition..Latitude
gsLongitude = MyPosition..Longitude
JSONResultado is JSON
vResultado is Variant
vPosicion is Variant



h est un httpRequête
h..Méthode = httpPost
h..URL = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
h..ContentType = "application/json"
h..Entête["Authorization"] = "xxxxxxxxxxxxxxxxxxxxxxxxxx"


vPosicion.Empleado = gsIdCodiEmpleatLogged
vPosicion.Dispositivo = SysIdentifier()
vPosicion.Latitud = gsLatitude
vPosicion.Longitud = gsLongitude
vPosicion.Data = SysDateTime()
vPosicion.error = gsReport
vPosicion.DataError = dtData


h..Contenu = VariantVersJSON(vPosicion)

r est un restRéponse = RESTEnvoie(h)

JSONResultado = r..Contenu

vResultado = JSONToVariant(JSONResultado)

As I comment it is quite simple, I understand that I do not have to call the procedure anywhere else, because the call is supposed to be made automatically, I do not know if someone can give me a hand.

Thank you in advance.
Membro registado
10 mensagems
Popularité : +1 (1 vote)
Publicado em junho, 03 2021 - 6:06 PM
thank you very much.