|
GRUPOS DE DISCUSSÃO PROFISSIONAL WINDEV, WEBDEV e WINDEV Mobile |
| | | | | |
Inicio → WINDEV 25 → WX - Colocando consulta Posição atual da pessoa em um aplicativo móvel com GPS |
WX - Colocando consulta Posição atual da pessoa em um aplicativo móvel com GPS |
Iniciado por BOLLER, nov., 02 2017 4:25 PM - 3 respostas |
| |
| | | |
|
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em novembro, 02 2017 - 4:25 PM |
Prezados,
Colocando consulta Posição atual da pessoa em um aplicativo móvel com GPS?
R.: Ao abrir a primeira tela defina esse código abaixo
GPSInitParameter(gpsAuto, gpsPrecisionLow + gpsEnergyHigh) IF GPSStatus() = gpsEnabled THEN GPSStatus(ProcGPS) ELSE Info("A Localização do aparelho está desativada. Ative a Localização nas configurações.") END
E
Procedure GPS_PlotarClienteELojas()
MapDeleteMarker(GoogleMaps)
MapDeleteAll(GoogleMaps)
ok is boolean = False
nContador is int = 0
rDistancia is real = 0
rMenorDistancia is real = 1000000000000000
STC_Distancias = "" MarkerCliente..Position.Latitude = grlatitude MarkerCliente..Position.Longitude = grlongitude MarkerCliente..Name = "Você" MarkerCliente..Description = "Você" MarkerCliente..Image = IMG_ClienteMini
IF grlatitude <> 0 AND grlongitude <> 0 MapAddMarker(GoogleMaps, MarkerCliente) END
MapDisplayPosition(GoogleMaps,gloMinhaPosicao) MapGetPosition(GoogleMaps) GoogleMaps..Zoom = 18
WS_Mapa()
HExecuteQuery(QRY_Select_Mapas,hQueryDefault)
FOR EACH QRY_Select_Mapas IF HFound(QRY_Select_Mapas) = True THEN nContador+= 1 gloLojaPosicao..Latitude = QRY_Select_Mapas.t010_latitude gloLojaPosicao..Longitude = QRY_Select_Mapas.t010_longitude MarkerLoja..Position.Latitude = QRY_Select_Mapas.t010_latitude MarkerLoja..Position.Longitude = QRY_Select_Mapas.t010_longitude MarkerLoja..Name = "Loja "+QRY_Select_Mapas.t010_filial +" - "+ nContador MarkerLoja..Description = QRY_Select_Mapas.t010_endereco +", "+ QRY_Select_Mapas.t010_filial MarkerLoja..ActionClick = ProcAcaoClickinMarker IF Lower(QRY_Select_Mapas.t010_IconUrl) = "loja01" MarkerLoja..Image = IMG_loja01Mini ELSE IF Lower(QRY_Select_Mapas.t010_IconUrl) = "loja02" MarkerLoja..Image = IMG_loja02Mini ELSE MarkerLoja..Image = IMG_loja02Mini END rDistancia = geoDistance(gloMinhaPosicao,gloLojaPosicao,geoMeter) IF rDistancia > 0 AND rMenorDistancia > rDistancia THEN rMenorDistancia = rDistancia gloLojaMaisProxima..Latitude = QRY_Select_Mapas.t010_latitude gloLojaMaisProxima..Longitude = QRY_Select_Mapas.t010_longitude STC_Distancias += "Loja "+QRY_Select_Mapas.t010_filial +" - "+ QRY_Select_Mapas.t010_endereco +", "+ QRY_Select_Mapas.t010_filial + " " + CR END MapAddMarker(GoogleMaps, MarkerLoja) END END
IF gloMinhaPosicao..Latitude <> 0 AND gloMinhaPosicao..Longitude <> 0
MapDisplayPosition(GoogleMaps,gloMinhaPosicao) MapGetPosition(GoogleMaps)
END
GoogleMaps..Zoom = 12
e
Procedure WS_Mapa()
IF gbLogado = True THEN servico1 is ViaVarejoWS.Mapa servico1.ent = ent
ret1 is MapaResponse = WebserviceLoja.Mapa(servico1)
lo is a cLocalidade gloStatus = ret1.MapaResult.status
gloStatusMessage = ret1.MapaResult.statusMessage Distancia, x is int = 0 PosicaoLoja is geoPosition HDeleteAll(t010_mapa)
FOR EACH lo OF ret1.MapaResult.localidade.cLocalidade
PosicaoLoja..Latitude = lo.latitude PosicaoLoja..Longitude = lo.longitude
IF x <= 3 Distancia = geoDistance(gloMinhaPosicao,PosicaoLoja,geoKilometer) GloTextoDistancia += Distancia + " KM " + lo.filial END
t010_mapa.t010_endereco = lo.endereco t010_mapa.t010_filial = lo.filial t010_mapa.t010_IconUrl = lo.IconUrl t010_mapa.t010_latitude = lo.latitude t010_mapa.t010_longitude = lo.longitude t010_mapa.t010_status = ret1.MapaResult.status t010_mapa.t010_statusMessage = ret1.MapaResult.statusMessage IF Length(lo.latitude) > 0 AND Length(lo.longitude) > 0 ok is boolean = HAdd(t010_mapa) IF ok = False Info("Erro em T010: "+ErrorInfo()+HErrorInfo) END END
END END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Mensagem modificada, novembro, 02 2017 - 4:27 PM |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em fevereiro, 08 2018 - 6:22 PM |
Procedure ProcGPS(GPS_Status is int)
SWITCH GPS_Status CASE gpsUnavailable CASE gpsEnabled CASE gpsDisabled CASE gpsAvailable gloMinhaPosicao = GPSGetPosition(1000,"Obtendo sua localização...") IF ErrorOccurred = False THEN GPSEnd() ELSE GPSStatus(ProcGPS) END ent.latitude = gloMinhaPosicao.Latitude ent.longitude = gloMinhaPosicao.Longitude grlatitude = ent.latitude grlongitude = ent.longitude CASE gpsOffService OTHER CASE END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em fevereiro, 08 2018 - 6:27 PM |
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") gbStatusGps = False ELSE ChangeGPSStatus(GPSStatus()) END
GPSStatus(ChangeGPSStatus)
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 CASE gpsDisabled GloGpsAtivado = False gbStatusGps = False CASE gpsOffService CASE gpsUnavailable CASE gpsAvailable END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Mensagem modificada, fevereiro, 08 2018 - 6:27 PM |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.655 mensagems Popularité : +175 (223 votes) |
|
Publicado em fevereiro, 04 2022 - 12:58 AM |
Procedure Proc_GPS_Status(GPS_Status is int)
SWITCH GPS_Status CASE gpsUnavailable ToastDisplay("GPS Indisponível") CASE gpsEnabled ToastDisplay("GPS está ativado") CASE gpsDisabled ToastDisplay("GPS está desabilitado") CASE gpsAvailable gloMinhaPosicao = GPSGetPosition(1000,"Obtendo sua localização...") IF ErrorOccurred = False THEN GPSEnd() ELSE Info(gloMinhaPosicao.Latitude, gloMinhaPosicao.Longitude) END CASE gpsOffService ToastDisplay("GPS fora de serviço") OTHER CASE ToastDisplay("Informação Inesperada") END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|