You are previewing Xamarin Cross-platform Application Development - Second Edition.
O'Reilly logo
Xamarin Cross-platform Application Development - Second Edition

Book Description

Develop production-ready applications for iOS and Android using Xamarin

In Detail

Developing a mobile application for just one platform is becoming a thing of the past. Companies expect their apps to be supported on both iOS and Android, while leveraging the best native features on both. Xamarin's tools help ease this problem by giving developers a single toolset to target both platforms.

This book is a step-by-step guide to building real-world applications for iOS and Android. The book walks you through building a chat application, complete with a backend web service and native features such as GPS location, camera, and push notifications. Additionally, you'll learn how to use external libraries with Xamarin and Xamarin.Forms to create shared user interfaces and make app-store-ready applications. This second edition has been updated with new screenshots and detailed steps to provide you with a holistic overview of the new features incorporated in Xamarin 3. By the end of the book, you will have gained expertise to build on the concepts learned and effectively develop a market-ready cross-platform application.

What You Will Learn

  • Learn Apple's MVC design pattern

  • Understand the Android activity lifecycle

  • Share C# code across platforms and call native Objective-C or Java libraries from C#

  • Get to grips with unit testing for mobile applications

  • Implement a web service with Azure Mobile Services

  • Deploy and debug your application on mobile devices

  • Submit your app to the Apple App Store and Google Play

  • 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 files e-mailed directly to you.

    Table of Contents

    1. Xamarin Cross-platform Application Development Second Edition
      1. Table of Contents
      2. Xamarin Cross-platform Application Development Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Setting Up Xamarin
        1. The Xamarin tools
        2. Installing Xcode
        3. Installing Xamarin
        4. Choosing a Xamarin license
        5. Setting up the Android emulator
        6. Enrolling in the iOS Developer Program
        7. Registering as a Google Play developer
        8. Summary
      9. 2. Hello, Platforms!
        1. Building your first iOS application
        2. Understanding Apple's MVC pattern
        3. Using the iOS designer
        4. Building your first Android application
        5. Android activities
        6. Xamarin's Android designer
        7. Summary
      10. 3. Code Sharing between iOS and Android
        1. Learning the MVVM design pattern
          1. Implementing MVVM in an example
        2. Comparing project organization strategies
          1. Setting up a cross-platform solution
        3. Working with Portable Class Libraries
          1. Using PCLs in Xamarin
        4. Using preprocessor statements
        5. Simplifying dependency injection
        6. Implementing Inversion of Control
        7. Summary
      11. 4. XamChat – a Cross-platform App
        1. Starting our sample application concept
        2. Developing our Model layer
        3. Writing a mock web service
        4. Writing the ViewModel layer
          1. Implementing our LoginViewModel class
          2. Implementing our RegisterViewModel class
          3. Implementing our FriendViewModel class
          4. Implementing our MessageViewModel class
        5. Writing unit tests
          1. Setting up a new project for unit tests
          2. Writing assertions
        6. Summary
      12. 5. XamChat for iOS
        1. Understanding the basics of an iOS app
        2. Using UINavigationController
          1. Methods in Navigation Controllers
          2. Setting up a Navigation Controller
        3. Implementing the login screen
          1. Creating a LoginController class
          2. Modifying the controller's layout
          3. Registering and subscribing view models and services
        4. Using segues and UITableView
        5. Adding a friends list screen
        6. Adding a list of messages
        7. Composing messages
        8. Summary
      13. 6. XamChat for Android
        1. Introducing Android Manifest
          1. Setting up the Manifest
            1. Common manifest permissions
          2. Creating and implementing the application class
        2. Adding a login screen
          1. Layouts and ViewGroups in Andorid
          2. Implementing the login functionality
        3. Using ListView and BaseAdapter
          1. Implementing the conversations screen
          2. Setting up the adapter
        4. Implementing the friends list
        5. Composing messages
        6. Summary
      14. 7. Deploying and Testing on Devices
        1. iOS provisioning
          1. Prerequisites for deploying to iOS
          2. Creating a provisioning profile
        2. Android device settings
        3. Understanding the linker
        4. Understanding AOT compilation
        5. Avoiding common memory pitfalls
          1. Garbage collector
          2. Memory leaks
          3. Accessing objects disposed by GC
        6. Summary
      15. 8. Web Services with Push Notifications
        1. Learning Windows Azure
        2. Setting up your Azure account
        3. Exploring Azure Mobile Services
        4. Creating tables and scripts
        5. Adding a backend to XamChat
          1. Adding the Azure Mobile Services NuGet package
        6. Using the Apple Push Notification service
          1. Setting up proper provisioning
          2. Setting up your provisioning profile
          3. Setting up a certificate signing request
          4. Making client-side changes for push notifications
        7. Implementing Google Cloud Messaging
        8. Summary
      16. 9. Third-party Libraries
        1. The Xamarin Component Store
          1. The most common components
        2. Porting existing C# libraries
        3. Objective-C bindings
          1. Working with Objective Sharpie
        4. Java bindings
        5. Summary
      17. 10. Contacts, Camera, and Location
        1. Introducing Xamarin.Mobile
        2. Accessing contacts
          1. Retrieving contacts on Android
        3. Looking up GPS location
          1. Implementing GPS location on Android
        4. Accessing the photo library and camera
          1. Accessing photos on Android
        5. Summary
      18. 11. Xamarin.Forms
        1. Creating Hello World in Xamarin.Forms
        2. Understanding the architecture behind Xamarin.Forms
        3. Using XAML in Xamarin.Forms
        4. Using data binding and MVVM
        5. Summary
      19. 12. App Store Submission
        1. Following the iOS App Store Review Guidelines
          1. General rules
          2. Incorrect and incomplete information
          3. Content present in the application
          4. Apple's 70/30 revenue share
          5. General Tips
        2. Submitting an app to the iOS App Store
          1. Creating a distribution provisioning profile
          2. Adding your app to iTunes Connect
          3. Making an iOS binary for the App Store
        3. Signing your Android applications
        4. Submitting the app to Google Play
          1. Google Play Developer Program Policies
        5. Tips to make a successful mobile app
        6. Summary
      20. Index