Xamarin 4.x Cross-Platform Application Development - Third Edition
Xamarin 4.x Cross-Platform Application Development - Third Edition
Copyright Š 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2014
Second edition: February 2015
Third edition: December 2016
Production reference: 1201216
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-541-2
www.packtpub.com
Jonathan Peppers is a Xamarin MVP and lead developer on popular apps and games at Hitcents such as the Hanx Writer (for Tom Hanks) and the Draw a Stickman franchise. Jon has been working with C# for over 10 years working on a wide range of projects at Hitcents. Jon began his career working Self-Checkout software written in WinForms and later migrated to WPF. Over his career, he has worked with many .NET-centric technologies such as ASP.Net WebForms, MVC, Windows Azure, WinRT/UWP, F#, and Unity3D.
In recent years, Hitcents has been heavily investing in mobile development with Xamarin, and has development over 50 mobile applications across multiple platforms.
I would like to thank my wife, Amy Kate, and my son, Levi, for giving me the free time to write this book. You are both my inspiration and "why I do what I do".
Esteban Solano Granados is a senior software engineer, Microsoft and Xamarin MVP from Cartago, Costa Rica and he enjoys learning, talk, and help others to learn about software development for the web and mobile by using his knowledge of JavaScript and C# with Xamarin, Asp.Net, NodeJS and other technologies.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at
www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
[email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Thank you for purchasing this Packt book. We take our commitment to improving our content and products to meet your needs seriouslyâthat's why your feedback is so valuable. Whatever your feelings about your purchase, please consider leaving a review on this book's Amazon page. Not only will this help us, more importantly it will also help others in the community to make an informed decision about the resources that they invest in to learn.
You can also review for us on a regular basis by joining our reviewers' club.
If you're interested in joining, or would like to learn more about the benefits we offer, please contact us:
[email protected]Xamarin has built great products for developing iOS and Android applications in C#: Xamarin Studio, an addin for Visual Studio, Xamarin.iOS, and Xamarin.Android. Xamarin gives you direct access to the native APIs on each platform and the flexibility of sharing C# code. Using Xamarin and C#, you get better productivity when compared to Java or Objective-C, and still retain great performance compared to an HTML or JavaScript solution.
In this book, we will develop a real-world sample application to demonstrate what you can do with Xamarin technologies, and build on core platform concepts for iOS and Android. We will also cover advanced topics such as push notifications, retrieving contacts, using the camera, and GPS location. With Xamarin 3, a new framework was introduced called Xamarin.Forms. We will cover the basics of Xamarin.Forms and how you can apply it to cross-platform development. Finally, we will walkthrough what it takes to submit your application to the Apple App Store and Google Play.
Chapter 1, Xamarin Setup, is a guide for installing the appropriate Xamarin software and native SDKs for doing cross-platform development. Directs Windows users on how to connect to a Mac on their local network for doing iOS development in Visual Studio.
Chapter 2, Hello, Platforms!, is a walkthrough of creating a simple calculator application on iOS and Android, which also covers some basic concepts on each platform.
Chapter 3, Code Sharing between iOS and Android, is an introduction of code sharing techniques and project setup strategies that can be used with Xamarin.
Chapter 4, XamSnap - A Cross-Platform App, is an introduction to a sample application we will be building throughout the book. In this chapter we will write all the shared code for the application complete with unit tests.
Chapter 5, XamSnap for iOS, shows us how to implement the iOS user interface for XamSnap and cover various iOS development concepts.
Chapter6, XamSnap for Android, shows us how to implement the Android version of XamSnap and introduce Android-specific development concepts.
Chapter 7, Deploying and Testing on Devices, is a walkthrough the painful process of deploying your first application to a device. We also cover why it is important to always test your application on real devices.
Chapter 8, Contacts, Camera, and Location, introduces the library, Xamarin.Mobile, as a cross-platform way to access usersâ contacts, camera, and GPS location and add these features to our XamSnap application.
Chapter 9, Web Services with Push Notifications, shows us how to implement a real backend web service for XamSnap using Windows Azure leveraging Azure Functions and Azure Notification Hubs.
Chapter 10, Third-Party Libraries, covers the various options of using third party libraries with Xamarin and how you can even leverage native Java and Objective-C libraries.
Chapter 11, Xamarin.Forms, helps us discover Xamarin's latest framework, Xamarin.Forms, and how you can leverage it to build cross-platform applications.
Chapter 12, App Store Submission, will walk us thr...