Book Image

Xamarin 4 By Example

By : Engin Polat, Mark Radacz
Book Image

Xamarin 4 By Example

By: Engin Polat, Mark Radacz

Overview of this book

The mobile app market is increasing exponentially every year. Xamarin Studio with its modern and powerful IDEs makes creating applications a lot easier by simplifying the development process. Xamarin will allow you and your team to create native applications by taking advantage of one of the most evolved programming language in the world: C#. This book will provide you with the basic skills you need to start developing mobile apps using C# and Xamarin. By working through the examples in each chapter, you will gain hands-on experience of creating a complete app that is fully functional by all means. Finally, you will learn to publish the app you created on the app market. Each project in this book will take you one step closer to becoming a professional app developer.
Table of Contents (16 chapters)
Xamarin 4 By Example
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
7
Monkey Puzzle Game – Processing Images

Preface

Microsoft released .NET Framework in February 2002 for Windows platform. The Mono Project was released in June 2004, and it brought .NET to Linux and Mac OS. In 2 years, the Mono Project creators saw a potential in C# and .NET, but they progressed slowly and in 2011, the Mono Project version 1.1 was released.

The Mono Project evolved in time and transformed into a huge cross-platform framework, changing its name to Xamarin.

In February 2016, Microsoft announced that it had acquired Xamarin, and later it was made free and open source.

At the time of writing, Microsoft is the biggest company investing in cross-platform development and helping developers to build applications easily.

Xamarin has several components that develop, build, and package projects in order to publish them on stores. A few such examples are Xamarin.Android, Xamarin.iOS, and Xamarin.Forms. Xamarin.Android and Xamarin.iOS solutions are targeting individual platforms such as Android and iOS. On the other hand, Xamarin.Forms targets all platforms in one solution.

In this book, you'll learn how to use Xamarin.Forms to develop cross-platform applications with different page types, layouts, views, and design patterns by using them.

What this book covers

Chapter 1, Getting Started with Xamarin, will help us discover the basics of cross-platform development and where its latest version Xamarin 4 fits. We'll also learn how to use the latest version, Xamarin Studio 6, as the IDE.

Chapter 2, Sharing Code between Platforms, will differentiate between Portable Class Libraries and Shared Projects. We will also explore the fundamentals of the MVVM pattern by using it.

Chapter 3, Exploring the UI Controls, will explain all the page types, layout types, view elements, and rendering models provided by the Xamarin framework out of the box.

Chapter 4, Data – the Monkeys Catalog, will show how the readers to create base types of entities, data access layers, business layers in order to use them along with any project that we'll develop. We'll also create core implementations of them.

Chapter 5, Cloud and Async Communication, will help us explore different formats, data, and channel types when communicating with a remote server. We'll explore the differences between a RESTful service and a WSDL service and develop a sample application.

Chapter 6, Custom Renderers, will describe customer renderers by creating one. Also, we'll learn to use AppLinks by example.

Chapter 7, Monkey Puzzle Game – Processing Images, will help us develop an example project from scratch. We'll develop custom renderers to complete the project.

Chapter 8, The People Around Me Application, explains how to develop an example project from scratch. We'll start preparing our development machine and end with a ready-to-publish application. We'll develop and communicate with a web backend in this example project.

Chapter 9, Testing – Spot the Bugs, will explain the importance of debugging, testing, and profiling. We'll learn about the different log panels of Xamarin Studio 6. We'll also learn the fundamentals of Xamarin Profiler and the Xamarin.UITest Framework.

Chapter 10, Publishing to the Market, helps us finalize this book by publishing a project to all three stores. Starting from building the project, we'll investigate the steps of creating developer accounts, readying the publish package, and uploading them to the stores.

What you need for this book

You'll need a computer and reliable Internet connection. Here is a full-featured list of the required applications:

  • Windows 10 OS or Mac OS X

  • Xamarin Studio 6

  • Visual Studio 2015 Community Edition

  • Android SDK

  • Xcode (if you have Mac machine and want to build iOS applications)

Apple requires iOS applications to be compiled on a Mac computer, Xamarin requires as well. All required applications can be downloaded from http://xamarin.com/download and https://www.visualstudio.com pages.

Who this book is for

This book is great if you’re already familiar with C# and want to break down the walls of developing applications to a single platform. It’s assumed that you have a good knowledge of the object-oriented programming paradigm.

If you want to be familiar with developing applications to all three platforms (Windows, Android, and iOS), this book is for you.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can start creating a folder called Base and a folder called Core inside the main Xamarin Form project."

A block of code is set as follows:

using SQLite.Net.Attributes; 
 
namespace XamarinByExample.MonkeysCatalogue 
{ 
    public class BaseEntity<TKey> 
    { 
        [PrimaryKey] 
        public TKey Key { 
            get; 
            set; 
        } 
    } 
}

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "To use a WSDL, we need to right-click on the project and select Add a Web Reference:"

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book 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.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Xamarin-4-By-Example. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.