Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Get actual Position from GPS/Wifi/gsm
- /// </summary>
- /// <returns></returns>
- private async Task<Geoposition> getLocation(int maxAgeInMinutes = 5, int timeOutinSeconds = 10)
- {
- Geolocator geolocator = new Geolocator();
- Geoposition geoposition = null;
- if (geolocator.LocationStatus != PositionStatus.Disabled) // Check if we can access the LocationService
- {
- geoposition = await geolocator.GetGeopositionAsync(
- maximumAge: TimeSpan.FromMinutes(maxAgeInMinutes),
- timeout: TimeSpan.FromSeconds(timeOutinSeconds)
- );
- }
- return geoposition;
- }
Advertisement
Add Comment
Please, Sign In to add comment