Is there an existing PCL that can be used?
Do you write custom code for each platform?
Xamarin.Mobile component?
Mvvmcross location plugin (how can I get this working with Xamarin.Forms)?
Thanks all,
Paul
0
Posts
JasonAwbreyUSInsider, University, Developer Group Leadermod
Xamarin.Forms.Maps has a built in cross-platform geolocation API. Otherwise I would try Xamarin.Mobile
@JonDouglas would you use that code within each of your UI projects or is there a way to use Xamarin.Mobile within a PCL(Core project)?
0
JonDouglasUSXamarin Team, University, Developer Group LeaderXamurai
edited June 2014
You would probably use that code within each of your UI projects as I don't believe it's PCL-compat(And it has different versions for iOS/Android). However you could always create an Interface at your PCL level, and implementations on the platform level. You would then use DI/IoC to resolve the proper implementation when writing core logic.
Pull down https://github.com/XForms/XForms-Toolkit
Compile
Reference XForms.Toolkit.Droid in my Droid UI project
Reference XForms.Toolkit in my Core (pcl project)
DependencyService.Get<IGeolocator>();
Posts
Xamarin.Forms.Maps has a built in cross-platform geolocation API. Otherwise I would try Xamarin.Mobile
I am looking for a way to retrieve the current location (lat & lon). Doesn't look like that's supported by the Maps module. Or am I missing something?
@PaulP You can still get the current location using Xamarin.Mobile (https://components.xamarin.com/view/xamarin.mobile)
To get the user's location (requires ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions on Android):
@JonDouglas would you use that code within each of your UI projects or is there a way to use Xamarin.Mobile within a PCL(Core project)?
You would probably use that code within each of your UI projects as I don't believe it's PCL-compat(And it has different versions for iOS/Android). However you could always create an Interface at your PCL level, and implementations on the platform level. You would then use DI/IoC to resolve the proper implementation when writing core logic.
The Xamarin.Mobile geolocation was ported over to XForms.Toolkit as PCL compatible interface.
https://github.com/XForms/XForms-Toolkit
https://github.com/XForms/XForms-Toolkit/blob/master/src/XForms.Toolkit/XForms.Toolkit/Services/GeoLocation/IGeolocator.cs
@Skall how should I go about implementing?
Does that look right to you?
Yes, that looks correct.