Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Get date by GPS

$
0
0

I'm trying to get the current date through GPS.

I created the following code:

            protected override void OnResume()
            {
                base.OnResume();
                locationManager = GetSystemService (Context.LocationService) as LocationManager;
                locationManager.RequestLocationUpdates (LocationManager.GpsProvider, 1000, 1, this);

            }

        public void OnLocationChanged (Android.Locations.Location location)
        {
            Log.Debug (tag, "Location changed");
            DateTime dt = new DateTime (location.Time);
            txtStatusGPS.Text = dt.ToString ();
        }

But the current date is coming as follows: 01/02/0001 The hour is coming, it's only going missing for a given region.

Can anyone help me?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>