Tag: location

2020.09.01.

Xamarin.Forms – Mock Locations

This Project you can find at: https://github.com/officialdoniald/Xamarin.Forms.MockLocation. Download my NuGet Package: NuGet Gallery | Xamarin.MockLocationPlugin 1.0.0 Android: First, we have to request permissions in the Manifest and in the MainActivity (Runtime). Manifest: https://github.com/officialdoniald/Xamarin.Forms.MockLocation/blob/master/Xamarin.Forms.MockLocation.Mobile/Xamarin.Forms.MockLocation.Mobile.Android/Properties/AndroidManifest.xml MainActivity: https://github.com/officialdoniald/Xamarin.Forms.MockLocation/blob/master/Xamarin.Forms.MockLocation.Mobile/Xamarin.Forms.MockLocation.Mobile.Android/MainActivity.cs Sending mock lockation from Standard Library: DependencyService.Get().SendMockLocation(new IMockLocationPlugin.MockPosition() { Longitude = 24.234234, Latitude = 46.3213123, Accuracy = 1.0f, Altitude = 15, Bearing = 5f, Speed = 50f }); Deploy your […]

2020.09.01.

Xamarin.Forms get user location when it change

This project you can find at: https://github.com/officialdoniald/Xamarin.Forms.DetectUserLocationCange When you need to update the user’s location when it change you can make it in Xamarin.Forms too via DependencyService or using Xamarin.Essentials and create a Timer and get the actual Location per seconds (don’t do that :D). Before coding, we have to satisfy the users permissons. Andorid: (https://github.com/officialdoniald/Xamarin.Forms.DetectUserLocationCange/blob/master/Xamarin.Forms.DetectUserLocationCange/Xamarin.Forms.DetectUserLocationCange.Android/Properties/AndroidManifest.xml) Turn ACCESS_COARSE_LOCATION on. iOS: (https://github.com/officialdoniald/Xamarin.Forms.DetectUserLocationCange/blob/master/Xamarin.Forms.DetectUserLocationCange/Xamarin.Forms.DetectUserLocationCange.iOS/Info.plist) ATTENTION: if you will […]