Mobile Development with C#
Greg Shackles
Copyright 2012 Greg Shackles
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (.
Nutshell Handbook, the Nutshell Handbook logo, and the OReilly logo are registered trademarks of OReilly Media, Inc. Mobile Development with C# , the Caspian tern, and related trade dress are trademarks of OReilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and OReilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
O'Reilly Media
Preface
As you start to look at getting into mobile development, it can be overwhelming to try and choose between all the different options and platforms available to you. Each platform comes with its own set of tools, preferred languages, and overall way of doing things. In many cases, you wont want to restrict your application to a single platform, so naturally youll start looking for ways to reuse your code across the different platforms. If youre a .NET developer, you are already in a great position, as you can actually leverage the .NET framework across iOS, Android, and Windows Phone, and hit the ground running on all of them.
This book will introduce you to all three platforms from the ground up, exploring how to write native applications for each of them. As part of this exploration, you will see how to perform some common tasks required by applications, such as accessing the network, finding the users location, and persisting data on the device. In addition to learning about the platforms themselves, you will see how you can use .NET and C# to build these native applications, as well as various techniques for achieving a large amount of code reuse across all of them.
Who Is This Book For?
This book assumes that you are already familiar with the basics of the .NET Framework and the C# programming language. If you arent already experienced in either of these, this book will still be useful, but I first suggest familiarizing yourself with the basics before diving in.
That said, this book does not assume any level of familiarity with mobile development prior to reading. If youre brand new to mobile development, or even if youre familiar with the platforms but are curious to see how to leverage C# across them, this book will walk you through everything you need in order to get started writing your applications.
Contents of This Book
Introduces the different platforms and options for developing applications for them
Walks you through setting up your environments and creating your first application on each platform
Presents several techniques to help maximize code reuse across each platform
Describes how to access network resources in your applications
Introduces several methods for saving data in an application, including the filesystem and local databases
Demonstrates how to access a users location in an application, as well as how to use each platforms mapping APIs
Explains how to customize Android virtual devices in order to emulate different device configurations
Lists various resources for learning more about developing for each platform
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This icon signifies a tip, suggestion, or general note.
Caution
This icon indicates a warning or caution.
This Books Example Files
You can download all of the code examples from this book from the following locations:
http://github.com/gshackles/MobileDevelopmentInCSharpBook
http://examples.oreilly.com/0636920024002/
In the example files you will find the completed versions of the applications built in every chapter of the book, which will contain all the code required to run them.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Mobile Development with C# by Greg Shackles (OReilly). Copyright 2012 Greg Shackles, 978-1-449-32023-2.
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .
Safari Books Online
Note
Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
OReilly Media, Inc. |
1005 Gravenstein Highway North |
Sebastopol, CA 95472 |
800-998-9938 (in the United States or Canada) |