O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Xamarin 4.x Cross-Platform Application Development - Third Edition

Book Description

Develop powerful cross-platform applications with Xamarin

About This Book

  • Write native cross-platform applications with Xamarin
  • Design user interfaces that can be shared across Android, iOS, and Windows Phone using Xamarin.Forms
  • Practical cross-platform development strategies

Who This Book Is For

If you are a developer with experience in C# and are just getting into mobile development, this is the book for you. This book will give you a head start with cross-platform development and will be the most useful to developers who have experience with desktop applications or the web.

What You Will Learn

  • Apple’s MVC design pattern
  • The Android activity lifecycle
  • Share C# code across platforms and call native Objective-C or Java libraries from C#
  • Create a real web service back end in Windows Azure using SQL Azure as database storage
  • Set up third-party libraries such as NuGet and Objective Sharpie in many different ways, and port a desktop .NET library to Xamarin
  • Use Xamarin.Mobile for camera, contacts, and location

In Detail

Xamarin is a leading cross-platform application development tool used by top companies such as Coca-Cola, Honeywell, and Alaska Airlines to build apps. Version 4 features significant updates to the platform including the release of Xamarin.Forms 2.0 and improvements have been made to the iOS and Android designers. Xamarin was acquired by Microsoft so it is now a part of the Visual Studio family.

This book will show you how to build applications for iOS, Android, and Windows. You will be walked through the process of creating an application that comes complete with a back-end web service and native features such as GPS location, camera, push notifications, and other core features. Additionally, you’ll learn how to use external libraries with Xamarin and Xamarin.Forms to create user interfaces. This book also provides instructions for Visual Studio and Windows.

This edition has been updated with new screenshots and detailed steps to provide you with a holistic overview of the new features in Xamarin 4.

Style and approach

This book offers a tutorial style approach to teach you the skills required to develop end-to-end cross-platform solutions with Xamarin.

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 4.x Cross-Platform Application Development - Third Edition
    1. Xamarin 4.x Cross-Platform Application Development - Third Edition
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Customer Feedback
    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. Xamarin Setup
      1. Understanding Xamarin
      2. Installing Xcode
      3. Installing Xamarin on Mac OS X
      4. Setting up the Android emulator
      5. Installing Xamarin on Windows
      6. Connecting Visual Studio to a Mac for iOS development
      7. Enrolling in the iOS developer program
      8. Registering as a Google Play developer
      9. 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. Understanding Android activities
      6. Xamarin's Android designer
      7. Summary
    10. 3. Code Sharing Between iOS and Android
      1. Learning the MVVM design pattern
      2. Comparing project organization strategies
      3. Setting up a shared project
      4. Working with portable class libraries
      5. Using preprocessor statements
      6. Simplifying dependency injection
      7. Implementing Inversion of Control
      8. Summary
    11. 4. XamSnap - 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. XamSnap for iOS
      1. Understanding the basics of an iOS app
      2. Xamarin.iOS Build Options
      3. Using UINavigationController
      4. Implementing the login screen
      5. Using segues for navigation
      6. Setting up UITableView
      7. Adding a friends list screen
      8. Adding a list of messages
      9. Composing messages
      10. Summary
    13. 6. XamSnap for Android
      1. Introducing the Android Manifest
      2. Setting up Material Design
      3. Adding a login screen
      4. Using ListView and BaseAdapter
      5. Implementing the friends list
      6. Composing messages
      7. Summary
    14. 7. Deploying and Testing on Devices
      1. iOS provisioning
      2. Android device settings
      3. Understanding the linker
      4. Understanding AOT compilation
      5. Avoiding common memory pitfalls
      6. Summary
    15. 8. 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
    16. 9. Web Services with Push Notifications
      1. Learning Windows Azure
        1. Setting up your Azure account
      2. Exploring Azure Functions
        1. Creating and calling Azure Functions
          1. Using HttpClient in C#
        2. Adding more Azure Functions
      3. Using the Apple Push Notification service
        1. Setting up your provision profile
        2. Setting up a certificate for push notifications
        3. Making client-side changes for push notifications
        4. Sending push notifications from the server-side
      4. Implementing Google Cloud Messaging
      5. Summary
    17. 10. Third-Party Libraries
      1. The Xamarin Component Store
      2. Porting existing C# libraries
      3. Objective-C bindings
      4. Java bindings
      5. Using XPath in Java bindings
      6. 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
      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 for building a successful mobile app
      6. Summary