Xamarin.Forms get data from device specific code back to the Forms

后端 未结 2 741
北恋
北恋 2021-01-25 12:05

I have tried, without luck, to get the current location from within the Xamarin.Forms code. I tried the Mobile Services for Xamarin.Forms from their sample code

2条回答
  •  Happy的楠姐
    2021-01-25 12:40

    Typically when you are using Xamarin.Forms and you want to access platform specific functionality, you will want to use a Dependency Service that will allow you to write code in the platform specific project to use special platform features or APIs. You can then reference this service from the Xamarin.Forms project and allows you to jump back and forth. There is some very good documentation on the Xamarin site for this.

    http://developer.xamarin.com/guides/cross-platform/xamarin-forms/dependency-service/

提交回复
热议问题