Book Image

Xamarin Cross-Platform Development Cookbook

By : George Taskos
Book Image

Xamarin Cross-Platform Development Cookbook

By: George Taskos

Overview of this book

<p>You can create native mobile applications using the Xamarin Forms platform for the three major platforms iOS, Android, and Windows Phone. The advantage of this is sharing as much code as you can, such as the UI, business logic, data models, SQLite data access, HTTP data access, and file storage across the three major platforms.</p> <p>This book provide recipes on how to create an architecture that will be maintainable, extendable, use Xamarin Forms plugins to boost productivity, customize your views per platforms, and use platform-specific implementations at runtime.</p> <p>We start with a simple creation of a Xamarin Forms solution with the three major platforms. We will then jump to XAML recipes and you will learn how to create a tabbed application page, and customize the style and behavior of views for each platform. Moving on, you will acquire more advanced knowledge and techniques while implementing views and pages for each platform and also calling native UI screens such as the native camera page.</p> <p>Further on, we demonstrate the power of architecting a cross-platform solution and how to share code between platforms, create abstractions, and inject platform-specific implementations. Next, you will utilize and access hardware features that vary from platform to platform with cross-platform techniques. Well then show you the power of databinding offered by Xamarin Forms and how you can create bindable models and use them in XAML. You will learn how to handle user interactions with the device and take actions in particular events.</p> <p>With all the work done and your application ready, you will master the steps of getting the app ready and publishing it in the app store.</p>
Table of Contents (18 chapters)
Xamarin Cross-Platform Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Leveraging native REST libraries and making efficient network calls


In a connected world, while your application grows, you will see that calls to web services are getting stressed and often, and all these calls will be asynchronous concurrent network requests.

Issuing a lot of requests will end up making your app slow, and managing these requests by hand, such as who has priority and when, or how many calls at a time are allowed, will break a lot of encapsulation between different components, resulting in spaghetti code.

It's ok! We can fix this. There are two libraries out there, created by Paul Betts, to save the day: modernhttpclient and Punchclock. Let's see how to install and use them in our network calls.

How to do it…

  1. In Visual Studio, create a Blank App (Xamarin.Forms Portable) solution named XamFormsEfficientNetworking from the top menu, File | New | Project….

  2. Right-click the portable class library, XamFormsEfficientNetworking, and choose Manage NuGet Packages. Search and install the...