Learn how to create the shared interface for a dependency service and use the interface to request the network status of the device before accessing network resources.
- [Instructor] We've looked at some…user interface differences for platforms,…but sometimes the reality is you have shared code…that needs to instantiate or run some code…that's gotta be platform specific,…there's just no way around it.…But for that, we can use a dependency service.…I'm gonna come over to my solution here,…pin this back on,…and I wanna add an interface to my project.…From our shared project, we'll come in,…we'll go into the General, Empty Interface,…and I call it iNetworkManager.…
I'm just gonna put a method on it…that says IsNetworkConnected.…We'll have that return a boolean,…indicating to us that the network's connected.…And what I wanna be able to do, is in my application,…before I go out and try and call that web API,…I wanna be able to check the device and find out…if it's connected to the network.…Our MainPage.xaml here, we went out…and we loaded up our products,…but we wanna check before doing that.…So I wanna use that INetworkManager…and I need to get an instance of it,…but checking network connectivity is different…
- Creating a Xamarin.Forms solution
- Navigating between pages
- Screen layouts and controls in Xamarin.Forms
- Data binding
- Adding style to a control
- Using a Xamarin.Essentials package
- Embedding native controls in your shared forms
- Writing custom renderers
Skill Level Beginner
Xamarin Development: Authentication and Identitywith Matt Milner1h 32m Intermediate
What you should know1m 21s
2. Layout and Controls
3. Native Platform Integration
4. Native Controls and Renderers
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.