public GeofenceLocation(GeofenceLocation loc) { Latitude = loc.Latitude; Longitude = loc.Longitude; Date = loc.Date; Accuracy = loc.Accuracy; }
internal void SetLastKnownLocation(Android.Locations.Location location) { if (location != null) { if (lastKnownGeofenceLocation == null) { lastKnownGeofenceLocation = new GeofenceLocation(); } lastKnownGeofenceLocation.Latitude = location.Latitude; lastKnownGeofenceLocation.Longitude = location.Longitude; double seconds = location.Time / 1000; lastKnownGeofenceLocation.Date = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local).AddSeconds(seconds); } }
void SetLastKnownLocation(CLLocation location) { if (location != null) { if (lastKnownGeofenceLocation == null) { lastKnownGeofenceLocation = new GeofenceLocation(); } lastKnownGeofenceLocation.Latitude = location.Coordinate.Latitude; lastKnownGeofenceLocation.Longitude = location.Coordinate.Longitude; lastKnownGeofenceLocation.Accuracy = location.HorizontalAccuracy; DateTime referenceDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(2001, 1, 1, 0, 0, 0)); referenceDate.AddSeconds(location.Timestamp.SecondsSinceReferenceDate); lastKnownGeofenceLocation.Date = referenceDate; } }