From the course: Xamarin.Forms Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Android service implementation

Android service implementation - Xamarin Tutorial

From the course: Xamarin.Forms Essential Training

Start my 1-month free trial

Android service implementation

- With our shared library code in place, we need to go into our Android application, and provide an implementation for the INetwork Manager. So to that Android project, I'll add a new file. I'm going to go in and add an empty class. And I'll just call it Network Manager. Got a couple of using statements up to the top here. So I want to use Android.Content. And I want to use the Android.net and spaces. And I need to implement that interface, so I can do high Network Manager. You know, just a little helpful tool here to implement the interface. We got our method defined there. And the key piece here is that, I need to tell Xamarin, and the Xamarin dependency service about this class. I'm going to do that with an assembly level attribute. I can do assembly, colon, Xamarin forms, dependency, and then it wants a type. So the type is going to be, HPlusSports Droid Network Manager. And that's telling the Xamarin dependency…

Contents