user2524179
user2524179

Reputation: 31

xamarin get location at cross-platform

i want to get location (use gps) at xamarin.form - that is, in cross platform. but i can't find. only platform-dependent (at android, at ios, etc.)

if you know, please share to me ! (i found xamarin.mobile - geolocation, but it is also platform-dependent T^T)

Upvotes: 3

Views: 8844

Answers (2)

Blanthor
Blanthor

Reputation: 2680

This is going to 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 -specific projects. The PCL will connect to the implementation through the Xamarin Forms DependencyService. Please have a look at the following link Accessing Native Features via the DependencyService

It is likely that you will be able to use the other examples on the Xamarin site to write your platform-specific code. For example here is a link to the Android LocationService

Upvotes: 6

Miha Markic
Miha Markic

Reputation: 3240

Checkout Forms Labs. It should be pretty simple to reuse it even without Xamarin.Forms (if that's the case).

Upvotes: 1

Related Questions