Adapter in Xamarin Forms Monkey.Robotics App

GeorgeEdwardsGeorgeEdwards GBMember ✭✭
edited August 2015 in Xamarin.Forms

I am using the Xamarin.Forms Bluetooth HRM Sample, [here]( https://github.com/conceptdev/xamarin-forms-samples/tree/master/BluetoothHeartRateMonitor}.

I am new to Xamarin and to using c# for writing apps. I have a couple of questions. Firstly, I want to create a new page which acts as a "home screen", which displays the received characteristics when the app is connected to a heart rate monitor.

The issue I am having, is that I haven't really understood what adapter is? So when I change the return new NavigationPage (new DeviceList (Adapter)); reference in app.cs in the main PCL, I get issues with passing through the adapter. How do I get to start_page (my new page) and be able to use BLE functionality in that page, whilst also then being able to navigate from that, to the DeviceList page?

Thanks

Answers

  • ChristianFalchChristianFalch NODeveloper Group Leader ✭✭✭

    The adapter is (as you can see from the declaration in the ```app.cs`` file) an Interface used for injection of a platform specific implementation.

    Take a look at the AppDelegate.cs file to see how this is done from iOS and in the file MainActivity.cs for the Android part of the sample.

    Try to follow the code in the debugger and get a good understanding of how it works before you try to modify it. This way you will also get a better understanding of how cross platform development with Xamarin.Forms is done, especially when trying to include platform specific implementations in your projects.

    Good luck!

Sign In or Register to comment.