You are previewing Xamarin Cross-Platform Development Cookbook.
O'Reilly logo
Xamarin Cross-Platform Development Cookbook

Book Description

A recipe-based practical guide to get you up and running with Xamarin cross-platform development

About This Book

  • Gain the skills and expertise to create, test, and deploy native mobile applications in the three major mobile app stores that share up to 95% of the same code

  • Learn development techniques that will allow you to use and create custom layouts for each platform, cross-platform UI

  • Gain the knowledge needed to become more efficient in testing, deploying, and monitoring your applications, helping you through all stages of the software development life cycle

  • Who This Book Is For

    This book is for mobile developers. You must have some basic experience of C# programming, but no previous experience with Xamarin is required. If you are just starting with C# and want to use Xamarin todevelop cross-platform apps effectively and efficiently, then this book is the right choice for you.

    What You Will Learn

  • Create and customize your cross-platform UI

  • Understand and explore cross-platform patterns and practices

  • Use the out-of-the-box services to support third-party libraries

  • Find out how to get feedback while your application is used by your users

  • Bind collections to ListView and customize its appearance with custom cells

  • Create shared data access using a local SQLite database and a REST service

  • Test and monitor your applications

  • In Detail

    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.

    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.

    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.

    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. We'll 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.

    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.

    Style and approach

    This book will serve as a quick reference with a unique recipe-based approach that will engage you like never before as you create real-world cross-platform apps on your own.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Xamarin Cross-Platform Development Cookbook
      1. Table of Contents
      2. Xamarin Cross-Platform Development Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why Subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. One Ring to Rule Them All
        1. Introduction
        2. Creating a cross-platform solution
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. See also
        3. Creating a cross-platform login screen
          1. How to do it...
          2. How it works…
          3. There's more…
        4. Using common platform features
          1. How to do it...
          2. How it works…
          3. See also
        5. Authenticating with Facebook and Google providers
          1. How to do it...
            1. For the Android project
            2. For the iOS project
          2. How it works…
          3. See also
      9. 2. Declare Once, Visualize Everywhere
        1. Introduction
        2. Creating a tabbed-page cross-platform application
          1. How to do it…
          2. How it works…
          3. See also
        3. Adding UI behaviors and triggers
          1. How to do it…
          2. How it works…
          3. See also
        4. Configuring XAML with platform-specific values
          1. How to do it…
          2. How it works…
          3. See also
        5. Using custom renderers to change the look and feel of views
          1. How to do it…
          2. How it works…
          3. See also
      10. 3. Native Platform-Specific Views and Behavior
        1. Introduction
        2. Showing native pages with renderers
          1. How to do it…
          2. How it works…
          3. See also
        3. Attaching platform-specific gestures
          1. How to do it…
          2. How it works…
          3. See also
        4. Taking an in-app photo with the native camera page
          1. How to do it…
          2. How it works…
          3. See also
      11. 4. Different Cars, Same Engine
        1. Introduction
        2. Sharing code between different platforms
          1. How to do it…
          2. How it works…
          3. See also
        3. Using the dependency locator
          1. How to do it…
          2. How it works…
          3. See also
        4. Adding a third-party Dependency Injection Container
          1. How to do it…
          2. How it works…
          3. See also
        5. Architecture design with Model-View-ViewModel (MVVM) pattern
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Using the event messenger
          1. How to do it…
          2. How it works…
          3. See also
        7. Adding localization
          1. How to do it…
          2. How it works…
          3. There's more…
      12. 5. Dude, Where's my Data?
        1. Introduction
        2. Creating a shared SQLite data access
          1. How to do it…
          2. How it works…
          3. See also
        3. Performing CRUD operations in SQLite
          1. How to do it…
          2. How it works…
          3. See also
        4. Consuming REST web services
          1. How to do it…
          2. How it works…
        5. Leveraging native REST libraries and making efficient network calls
          1. How to do it…
          2. How it works…
          3. There's more…
      13. 6. One for All and All for One
        1. Introduction
        2. Creating cross-platform plugins
          1. How to do it...
          2. How it works…
          3. There's more…
          4. See also
        3. Taking or choosing photos
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Getting the GPS location
          1. How to do it…
          2. How it works…
          3. See also
        5. Show and schedule local notifications
          1. How to do it…
          2. How it works…
          3. There's more…
      14. 7. Bind to the Data
        1. Introduction
        2. Binding data in code
          1. How to do it…
          2. How it works…
        3. Binding data in XAML
          1. How to do it…
          2. How it works…
        4. Configuring two-way data binding
          1. How to do it…
          2. How it works…
          3. See also
        5. Using value converters
          1. How to do it…
          2. How it works…
          3. See also
      15. 8. A List to View
        1. Introduction
        2. Displaying a collection and selecting a row
          1. How to do it…
          2. How it works…
          3. See also
        3. Adding, removing, and refreshing items
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Customizing the row template
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        5. Adding grouping and a jump index list
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
      16. 9. Gestures and Animations
        1. Introduction
        2. Adding gesture recognizers in XAML
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        3. Handling gestures with native platform renderers
          1. How to do it…
          2. How it works…
        4. Adding cross-platform animations
          1. How to do it…
          2. How it works…
          3. There's more…
      17. 10. Test Your Applications, You Must
        1. Introduction
        2. Creating unit tests
          1. How to do it…
          2. How it works…
        3. Creating acceptance tests with Xamarin.UITest
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Using the Xamarin.UITest REPL runtime shell to test the UI
          1. How to do it…
          2. How it works…
          3. See also
        5. Uploading and running tests in Xamarin Test Cloud
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
      18. 11. Three, Two, One – Launch and Monitor
        1. Introduction
        2. Using Xamarin Insights
          1. How to do it…
          2. How it works…
          3. There's more…
        3. Publishing iOS applications
          1. How to do it…
          2. How it works…
        4. Publishing Android applications
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        5. Publishing Windows Phone applications
          1. How to do it…
          2. How it works…
          3. There's more…
      19. Index