Xamarin get location on cross platform

I want to get location (use gps) on xamarin.form - i.e. cross platform. but I cannot find. platform only (android, ios, etc.)

If you know, please share with me! (I found xamarin.mobile - geolocation, but it also depends on the T ^ T platform)

+3


source to share


2 answers


This will be device specific. Probably the best approach is to create an interface in your portable class library and then implement the interface in your Android and iOS projects. The PCL will connect to the implementation through the Xamarin Forms DependencyService. Please see the following link Accessing Core Functions via DependencyService



You can probably use the other examples on the Xamarin site to write your platform-specific code. For example, here's a link to Android LocationService

+6


source


Checkout Forms Labs . It should be pretty easy to reuse it even without Xamarin.Forms (if so).



+1


source







All Articles