Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Desarrollo en Delphi para Android (https://www.clubdelphi.com/foros/forumdisplay.php?f=57)
-   -   ¿Es posible tomar la hora de la red telefonica? (https://www.clubdelphi.com/foros/showthread.php?t=92457)

jo3litro 03-11-2017 20:25:02

¿Es posible tomar la hora de la red telefonica?
 
Buenas a todos,

Sigo con mi tema de tomar hora en android.

Es posible tomar la hora de la red telefonica en vez de la hora del dispositivo ?

Saludos y gracias..

Casimiro Notevi 03-11-2017 21:41:00

¿De un servidor NTP?

jo3litro 03-11-2017 21:57:54

No de un servidor ntp. Tengo entendido que la operadora de celular (Vodafone, Movistar, etc), con su red ya envian una hora y una fecha por defecto.

En el celular puede tomar esta fecha o ajustarlo manualmente.

Lo que necesito es tomar la hora de cualquier lado que no sea del celular. Tener en cuenta que no tendre internet.

La idea es marcar una posicion satelital por decir a las 07:00 hs. El usuario tranquilamente puede cambiar la hora del cel y poner las 07:00 siendo las 9:15 por decir.

Al almacenar la hora hago hora := Time; pero toma la hora del telefono.. he buscado tomar la hora del satelite, pero no encuentro ni ejemplos o un componente que lo haga.

Estoy sin opciones...

Casimiro Notevi 03-11-2017 22:00:56

Sí puedes tomar la hora mediante el GPS.

jo3litro 03-11-2017 22:08:33

Como !!?

El componente que utilizo para tomar las coordenasas es LocationSensor1.

En su evento ejecuta

Procedure TLocalizacionForm.LocationSensor1LocationChanged(Sender: TObject; Const OldLocation, NewLocation: TLocationCoord2D);
Begin
ENUSLat := NewLocation.Latitude.ToString(ffGeneral, 5, 2, TFormatSettings.Create('en-US'));
ENUSLong := NewLocation.Longitude.ToString(ffGeneral, 5, 2, TFormatSettings.Create('en-US'));
edLatitud.Text := ENUSLat;
edLongitud.Text := ENUSLong;

End;

Casimiro Notevi 05-11-2017 13:26:54

Recuerda poner los tags al código fuente, ejemplo:



Gracias :)

jo3litro 06-11-2017 14:09:50

Código Delphi [-]
Procedure TLocalizacionForm.LocationSensor1LocationChanged(Sender: TObject; Const OldLocation, NewLocation: TLocationCoord2D);
Begin
ENUSLat := NewLocation.Latitude.ToString(ffGeneral, 5, 2, TFormatSettings.Create('en-US'));
ENUSLong := NewLocation.Longitude.ToString(ffGeneral, 5, 2, TFormatSettings.Create('en-US'));
edLatitud.Text := ENUSLat;
edLongitud.Text := ENUSLong;

End;


La franja horaria es GMT +2. Ahora son las 01:13:48.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi