How To Set Up Xamarin App Development On iOS and Android?
Xamarin App Development makes the mobile applications development very easy. It involves rigorous up-front design, usability testing, QA testing on thousands of devices, a full beta lifecycle, and then deployment a number of different ways. Likewise WEB SDLC, we have the Mobile Development SDLC. The lifecycle of mobile development is largely no different than the SDLC for web or desktop applications. As with those, there are usually 5 major portions of the process:
- Inception – All apps start with an idea. That idea is usually refined into a solid basis for an application.
- Design – The design phase consists of defining the app’s User Experience (UX) such as what the general layout is, how it works, etc., as well as turning that UX into a proper User Interface (UI) design, usually with the help of a graphic designer.
- Development – Usually the most resource intensive phase, this is the actual building of the application.
- Stabilization – When development is far enough along, QA usually begins to test the application and bugs are fixed. Often times an application will go into a limited beta phase in which a wider user audience is given a chance to use it and provide feedback and inform changes.
Following are the steps for setting up Xamarin App Development on Android for application development:
Understanding Android API Levels
This guide describes how Android uses API levels to manage app compatibility across different versions of Android, and it explains how to configure Xamarin.Android project settings to deploy these API levels in your app. In addition, this guide explains how to write run time code that deals with different API levels, and it provides a reference list of all Android API levels, version numbers (such as Android 7.1), Android code names (such as Oreo), and build version codes.
Resources in Android
This article introduces the concept of Android resources in Xamarin.Android and will document how to use them. It covers how to use resources in your Android application to support application localization, and multiple devices including varying screen sizes and densities.
Activities are a fundamental building block of Android Applications and they can exist in a number of different states. The activity lifecycle begins with instantiation and ends with destruction, and includes many states in between. When an activity changes state, the appropriate lifecycle event method is called, notifying the activity of the impending state change and allowing it to execute code to adapt to that change. This article examines the lifecycle of activities and explains the responsibility that an activity has during each of these state changes to be part of a well-behaved, reliable application.
This article covers Android services, which are Android components that allow work to be done in the background. It explains the different scenarios that services are suited for and shows how to implement them both for performing long-running background tasks as well as to provide an interface for remote procedure calls.
This guide covers how to create and use broadcast receivers, an Android component that responds to system-wide broadcasts, in Xamarin.Android.
You can use the tooling support built into Visual Studio for Mac or Visual Studio to create and add permissions to the Android Manifest. This document describes how to add permissions in Visual Studio and Xamarin Studio.
Graphics and Animation
Android provides a very rich and diverse framework for supporting 2D graphics and animations. This document will introduce these frameworks and discuss how to create custom graphics and animations and use them in a Xamarin.Android application.
Xamarin.Android supports several CPU architectures, including 32-bit and 64-bit devices. This article explains how to target an app to one or more Android-supported CPU architectures.
This article describes how to handle device orientation changes in Xamarin.Android. It covers how to work with the Android resource system to automatically load resources for a particular device orientation as well as how to programmatically handle orientation changes. Then it describes techniques for maintaining state when a device is rotated.
Working With Audio
The Android OS provides extensive support for multimedia, encompassing both audio and video. This guide focuses on audio in Android and covers playing and recording audio using the built-in audio player and recorder classes, as well as the low-level audio API. It also covers working with Audio events broadcast by other applications, so that developers can build well-behaved applications.
This section explains how to implement local and remote notifications in Xamarin.Android. It describes the various UI elements of an Android notification and discusses the API's involved with creating and displaying a notification. For remote notifications, both Google Cloud Messaging and Firebase Cloud Messaging are explained. Step-by-step walkthroughs and code samples are included.
This section explains the concepts and details of implementing touch gestures on Android. Touch APIs are introduced and explained followed by an exploration of gesture recognizers.
HttpClient Stack and SSL/TLS
This section explains the HttpClient Stack and SSL/TLS Implementation selectors for Android. These settings determine the HttpClient and SSL/TLS implementation that will be used by your Xamarin.Android apps.
The following sections explain the various tools and building blocks that are used to compose user interfaces in Xamarin Android apps.
Creating User Interfaces for Xamarin.Android Apps
This section explains how to use the Android Designer to lay out controls visually and edit properties. It also explains how to use the Designer to work with user interfaces and resources across various configurations, such as themes, languages, and device configurations, as well as how to design for alternative views like landscape and portrait.
Material Theme is the user interface style that determines the look and feel of views and activities in Android. Material Theme is built into Android, so it is used by the system UI as well as by applications. This guide introduces Material Design principles and explains how to theme an app using either built-in Material Themes or a custom theme.
This guide explains how to access the personal profile for the owner of a device, including contact data such as the device owner's name and phone number.
An Android app takes some time to to start up, especially when the app is first launched on a device. A splash screen may display start up progress to the user. This guide explains how to create a splash screen for your app.
Layouts are used to define the visual structure for a user interface. Layouts such as ListView and RecyclerView are the most fundamental building blocks of Android applications. Typically, a layout will use an Adapter to act as a bridge from the layout to the underlying data that is used to populate data items in the layout. This section explains how to use layouts such as LinearLayout, RelativeLayout, TableLayout, RecyclerView, and GridView.
Android controls (also called widgets) are the UI elements that you use to build a user interface. This section explains how to use controls such as buttons, toolbars, date/time pickers, calendars, spinners, switches, pop-up menus, view pagers, and web views.
Key Components of the Android Platform
Documents in this section cover features specific to Android. Here you'll find topics such as using Fragments, working with maps and encapsulating data with Content Providers.
Android Beam is a new Near Field Communication (NFC) technology in Android 4 that allows applications to share information over NFC when in close proximity.
This section discusses how to use fingerprint authentication, first introduced in Android 6.0, to a Xamarin.Android application.
Firebase Job Dispatcher
This guide discusses the Firebase Job Dispatcher and how to use it to simplify running background jobs in a Xamarin.Android app.
Android 3.0 introduced Fragments, showing how to support more flexible designs for the many different screen sizes found on phones and tablets. This article will cover how to use Fragments to develop Xamarin.Android applications, and also how to support Fragments on pre-Android 3.0 (API Level 11) devices.
This guide will discuss how Android 6.0 supports app-linking, a technique that allows mobile apps to respond to URLs on websites. It will discuss how to implement app-linking in an Android 6.0 application and how to configure a website to grant permissions to the mobile app to handle app-links for the domain.
Introduction to Content Providers
A Content Provider encapsulates a data repository and provides an API to access it. The provider exists as part of an Android application that usually also provides a UI for displaying/managing the data. The key benefit of using a content provider is enabling other applications to easily access the encapsulated data using a provider client object (called a ContentResolver). Together a content provider and content resolver offer a consistent inter-application API for data access that is simple to build and consume. This document shows how to access and build Content Providers with Xamarin.Android.
Maps and Location
This section discusses how to use maps and location with Xamarin.Android. It covers everything from leveraging the built-in maps application to using the Google Maps Android API v2 directly. Additionally, it explains how to use a single API to work with location services, which use cellular triangulation to allow an application to obtain location fixes, Wi-Fi location, and GPS.
This section discusses how to use the Android Text to Speech and Speech to Text facilities. It also covers installing language packs and interpretation of the text spoken to the device.
Data and Cloud Services
Xamarin.Android applications often need access to data (from either a local database or from the cloud), and many of these apps consume web services implemented using a wide variety of technologies. The guides in this section examine how to access data and make use of cloud services.
This section discusses data access in Xamarin.Android using SQLite as the database engine.
Google provides both Firebase Cloud Messaging and legacy Google Cloud Messaging services for facilitating messaging between mobile apps and server applications. This section provides overviews for each service provided by step-by-step explanation of how to use these services to implement remote notifications (also called push notifications) in Xamarin.Android applications.
Deployment and Testing
Stabilization and Deployment Guides
This section includes topics that explain how to test an application, optimize its performance, prepare it for release, sign it with a certificate, and publish it to an app store.
The guides in the section help you to debug your app using Android emulators, real Android devices, and the debug log.
There are many techniques for increasing the performance of applications built with Xamarin.Android. Collectively these techniques can greatly reduce the amount of work being performed by a CPU, and the amount of memory consumed by an application.
Preparing an Application for Release
After an application has been coded and tested, it is necessary to prepare a package for distribution. The first task in preparing this package is to build the application for release, which mainly entails setting some application attributes.
Signing the Android Application Package
Learn how to create an Android signing identity, create a new signing certificate for Android applications, and sign the application with the signing certificate. In addition, this topic explains how to export the app to disk for ad-hoc distribution. The resulting APK can be sideloaded into Android devices without going through an app store.
Publishing an Application
Once a great application has been created, people will want to use it. These articles explain the steps for public distribution of an application created with Xamarin.Android. Distribution can take place via channels such as e-mail, a private web server, Google Play, or the Amazon App Store for Android.
Following are the steps for setting up Xamarin App Development on iOS for application development:
First install Xamarin.iOS on a Mac. Once you have successfully installed Xamarin.iOS, you can develop and test a Xamarin.iOS application on device.
This section provides a guide on some of the more common things tasks or concepts that developers need to be aware of when developing Xamarin.iOS (formerly MonoTouch) applications.
App Transport Security
This article will introduce the security changes that App Transport Security enforces on an iOS 9 app and what this means for your Xamarin.iOS projects, it will cover the ATS configuration options and it will cover how to opt-out of ATS, if required. Because ATS is enabled by default, any non-secure internet connections will raise an exception in iOS 9 apps (unless you've explicitly allowed it).
Background processing or backgrounding is the process of letting applications perform tasks in the background while another application is running in the foreground. This guide serves as an introduction to background processing in iOS.
Events, Protocols, and Delegates
This article presents the key iOS technologies used to receive callbacks and to populate user interface controls with data. These technologies are events, protocols, and delegates; this article explains what each of these is and how each is used from C#. It demonstrates how Xamarin.iOS uses iOS controls to expose familiar .NET events, as well as how Xamarin.iOS provides support for Objective-C concepts such as protocols and delegates (Objective-C delegates should not be confused with C# delegates). This article also provides examples that show how protocols are used both as the basis for Objective-C delegates and in non-delegate scenarios.
This article discusses threading in a Xamarin.iOS application, and talks a bit about the the .NET thread pool, responsive applications, and garbage collection.
Working with Images
This article examines how to use images in Xamarin.iOS, both application support images (such as icons, loading images, etc.) and images within applications (such as images applied to controls). It also covers how to use Visual Studio for Mac to incorporate images as well as how to interact with images from code.
Working with Property Lists
This document introduces Visual Studio for Mac's graphical and advanced property list (.plist) editor for working with Info.plist and Entitlements.plist. It illustrates setting icons and launch images for iOS application, and demonstrates specifying app capabilities (entitlements) from inside Visual Studio for Mac.
Working with the File System
Xamarin.iOS can use the same System.IO classes to work with files and directories in iOS that you would use in any .NET application. However, despite the familiar classes and methods, iOS implements some restrictions on the files that can be created or accessed and also provides special features for certain directories. This article outlines these restrictions and features, and demonstrates how file access works in a Xamarin.iOS application.
Creating iOS Applications in Code
This article examines how to create iOS applications entirely in code using Visual Studio and Visual Studio for Mac. It shows how to start from an empty project template to build an application screen in a controller by creating a hierarchy of views from UIKit. Then, it discusses how to create custom views that can be loaded in a controller.
Working with User Defaults
The NSUserDefaults class provides a way for iOS Apps and Extensions to programmatically interact with the system-wide Default System. By using the Defaults System, the user can configure an app's behavior or styling to meet their preferences (based on the design of the app). For example, to present data in Metric vs Imperial measurements or select a given UI Theme.
Touch screens on many of today’s devices allow users to quickly and efficiently interact with devices in a natural and intuitive way. This interaction is not limited just to simple touch detection – it is possible to use gestures as well. For example, the pinch-to-zoom gesture is a very common example of this – by pinching a part of the screen with two fingers the user can zoom in or out. This guide examines touch and gestures in iOS.
Working with Security and Privacy
Apple has made several enhancements to both security and privacy in iOS 10 (and greater) that will help the developer improve the security of their apps and ensure the end user's privacy. This article will cover implementing these features in a Xamarin.iOS app.
UX and controls
General User Experience (UX) coverage including controls, the designer and UX design principles.
We have built a designer for the iOS storyboard format which is fully integrated into Visual Studio for Mac. The iOS designer maintains full compatibility with the storyboard format, so that files can be edited in either Xcode or Visual Studio for Mac. Additionally, the editor supports advanced features, such as custom controls that render at design-time in the editor.
Introduction to Storyboards
A Storyboard is a visual representation of the appearance and flow of your application. Xamarin has introduced a Designer to allow Xamarin.iOS applications to take advantage of storyboards, so you can design your application screen visually and access the views, controllers and segues with C# for more control. You can also refer to this guide for an explanation and walkthrough of the Xamarin Designer for iOS
User Interface in iOS
Covers working with the iOS User Interface in a Xamarin.iOS app including: the Appearance API, Creating User Interface Objects, Layout Options, Providing Haptic Feedback and Working with the UI Thread.
User Interface Controls
Xamarin.iOS exposes all the native user interface objects provided by Apple. They are easily added to Xamarin.iOS applications using the iOS Designer, Xcode's Interface Builder or programmatically. Regardless of which method you choose, Xamarin.iOS exposes all the user interface object properties and methods in C#.
Key Components of the iOS Platform:
Introduction to iOS 11
How to install and get started with the Xcode 9 beta and the preview of Xamarin's iOS 11 support.
Introduction to iOS 10
Apple's iOS 10 includes several new APIs and services that allow you to develop apps with new features and functionality. With iOS 10, apps have new abilities such as extending Maps, Messages, Phone and Siri. This section shows hows to take advantage of these features in a Xamarin.iOS app.
Introduction to iOS 9
This section defines the changes made in iOS 9 when upgrading from iOS 8 and how to use these features in a Xamarin.iOS app.
Introduction to iOS 8
Apple's iOS 8 made a large number of changes to the operating system from iOS 7. Here, we show what they are and how to use them.
Introduction to iOS 7
About the major new APIs introduced in iOS 7, including View Controller transitions, enhancements to UIView animations, UIKit Dynamics, and Text Kit.
Introduction to iOS 6
Explanations of the features introduced in iOS 6, including Collection Views, Pass Kit, Event Kit, and the Social Framework.
Apple Pay was introduced alongside iOS 8, enabling users to pay for physical goods such as food, entertainment, and memberships via their iOS devices. It is available on iPhone 6 and iPhone 6 Plus, and can also be paired with the Apple Watch for in-store purchases. When used on an iPhone, it uses Touch ID as a way to confirm and authorize transactions to a user's credit or debit card.
This article will provide and introduction to using the new 3D Touch APIs to add pressure sensitive gestures to your Xamarin.iOS apps that are running on the new iPhone 6s and iPhone 6s Plus devices.
The new CallKit API in iOS 10 provides a way for VOIP apps to integrate with the iPhone UI and provide a familiar interface and experience to the end user. With this API users can view and interact with VOIP calls from the iOS device's Lock Screen and manage contacts using the Phone app's Favorites and Recents views.
Contacts and ContactsUI
With the introduction of iOS 9, Apple has released two new frameworks, Contacts and ContactsUI, that replace the existing Address Book and Address Book UI frameworks used by iOS 8 and earlier.
The Document Picker allows documents to be shared between apps. These documents may be stored in iCloud or in a different app’s directory. Documents are shared via the set of Document Provider Extensions the user has installed on their device.
iOS has two calendar-related applications built-in: the Calendar Application, and the Reminders Application. It’s straightforward enough to understand how the Calendar Application manages calendar data, but the Reminders Application is less obvious. Reminders can actually have dates associated with them in terms of when they’re due, when they’re completed, etc. As such, iOS stores all calendar data, whether it be calendar events or reminders, in one location, called the Calendar Database.
Extensions, as introduced in iOS 8, are specialized UIViewControllers that are presented by iOS inside standard contexts such as within the Notification Center, as custom keyboard types requested by the user to perform specialized input or other contexts like editing a photo where the Extension can provide special effect filters.
Graphics and Animation in iOS
Graphics and Animation in iOS covers core graphics concepts in iOS such as CoreImage, Core Graphics and Core Animation.
Apple introduced Handoff in iOS 8 and OS X Yosemite (10.10) to provide a common mechanism for the user to transfer activities started on one of their devices, to another device running the same app or another app that supports the same activity.
Health Kit provides a secure datastore for the user’s health-related information. Health Kit apps may, with the user’s explicit permission, read and write to this datastore and receive notifications when pertinent data is added. Apps can present the data, or user’s can use the Apple's provided Health app to view a dashboard of all their data.
Apple introduced HomeKit in iOS 8 to provide a common framework for discovering and communicating with home automation devices in a user's home. HomeKit provides a common platform for configuring devices and setting up actions to control them.
iOS applications can sell digital products or services using StoreKit – a set of APIs provided by iOS that communicate with Apple’s servers to conduct financial transactions with the user via their Apple ID. The StoreKit APIs are primarily concerned with retrieving product information and conducting transactions – there is no user-interface component. Applications that implement in-app purchasing must build their own user interface and track purchased items with custom code to provide the required products or services to the user.
iOS Gaming APIs
Apple has made several technological improvements to the gaming APIs in iOS 9 that make it easier to implement game graphics and audio in a Xamarin.iOS app. These include both ease of development through high-level frameworks and harnessing the power of the iOS device's GPU for improved speed and graphic abilities.
Message App Integration
New to iOS 10, a message App Extension integrates with the Messages app and presents new functionality to the user. The extension can send text, stickers, media files and interactive messages.
Multitasking for iPad
iOS 9 adds multitasking support for running two apps at the same time on specific iPad hardware. Multitasking for iPad is supported via the following features: Slide Over, Split View & Picture in Picture.
Passbook is an app for iPhones and iPod touches with iOS 6. It stores and displays barcodes and other information to link customer transactions on their phone with the ‘real world’. Passes are generated by merchants and sent to the customer via email, URLs or from within a merchant’s own iOS app. Passbook stores and organizes all the Passes on a phone, and displays Pass reminders on the lock-screen depending on the date/time or the location of the device.
This document introduces Passbook, using the Pass Kit API with Xamarin.iOS, and discusses how to implement Passes on your server.
Photo Kit is a new framework that allows applications to query the system image library and create custom user interfaces to view and modify its contents. It includes a number of classes that represent image and video assets, as well as collections of assets such as albums and folders.
Request App Review
New to iOS 10.3, the RequestReview() method allows an iOS app to ask the user to rate or review it. When this method is called in a shipping app that the user has installed from the App Store, iOS 10 will handle the entire rating and review process for the developer. Because this process is governed by App Store policy, an alert may or may not be displayed.
Search has been expanded in iOS 9 to provide great new ways to access information and features inside a Xamarin.iOS app. Using the new App Search APIs, app content is made searchable through Spotlight and Safari search results, Handoff and Siri Reminders and Suggestions. This allows users to quickly access activities and information deep within your app.
New to iOS 10, SiriKit allows an iOS app to provide services that are accessible to the user using Siri and the Maps app on an iOS device using App Extensions and the new Intents and Intents UI frameworks.
The Social Framework provides a unified API for interacting with social networks including Twitter and Facebook, as well as SinaWeibo for users in China.
iOS 10 includes a new Speech API that allows the app to support continuous speech recognition and transcribe speech (from live or recorded audio streams) into text.
Text Kit is a new API that offers powerful text layout and rendering features. It is built on top of the low level Core Text framework, but is much easier to use than Core Text.
Touch ID was introduced in iOS 7 as a means of authenticating the user - similar to a passcode. However, it was limited to unlocking the device, using the App Store, using iTunes and authenticating the iCloud keychain only.
New to iOS 10, the User Notification framework allows for the delivery and handling of local and remote notifications. Using this framework, the app or App Extension can schedule the delivery of local notifications by specifying a set of conditions such as location or time of day.
iOS 10 and macOS Sierra enhances the support for extended-range pixel formats and wide-gamut color spaces throughout the system including frameworks such as Core Graphics, Core Image, Metal and AVFoundation. Support for devices with wide color displays is further eased by providing this behavior throughout the entire graphics stack.
Data and Cloud Services
Stabilization and Deployment Guides
Most applications have some requirement to save data on the device locally. Unless the amount of data is trivially small, this usually requires a database and a data layer in the application to manage database access. iOS has the Sqlite database engine “built in” and access to the data is simplified by Xamarin’s platform which comes with the SQLite Data Provider.
The iCloud storage API in iOS 5 allows applications to save user documents and application-specific data to a central location and access those items from all the user's devices.
The CloudKit framework streamlines the development of applications that access iCloud. This includes the retrieval of application data and asset rights as well as being able to securely store application information. This kit gives users a layer of anonymity by allowing access to applications with their iCloud IDs without sharing personal information.
Deployment, Testing, and Metrics
Stabilization and Deployment Guides
This section covers topics used to test an application as well as how to distribute it. Topics here include things such as tools used for debugging, deployment to testers and how to publish an application to the App Store.
This article shows how to configure, build, and publish a Xamarin.iOS application for distribution through various different means, including:
App Store Distribution
In-House (Enterprise) Distribution
Ad Hoc Distribution
Ad-Hoc and Enterprise deployments allow developers to create packages that can be distributed for testing or to internal company users. This document explains how to create an IPA that can be synced to an iOS device using iTunes.
TestFlight is now owned by Apple, and is the primary way to beta test your Xamarin.iOS apps. This article will guide you through all steps of the TestFlight Process – from uploading your app, to working with iTunes Connect.
Debugging in Xamarin.iOS
Both the Visual Studio and Visual Studio for Mac IDEs include support for debugging Xamarin.iOS applications both in the iOS simulator and on iOS devices. This article shows how to use the debugger as well as how to configure various options it supports.
This document describes how to create unit tests for your Xamarin.iOS projects. Unit testing with Xamarin.iOS is done using the Touch.Unit framework that includes both an iOS test runner as well as a modified version of the NUnitLite framework that provides a familiar set of APIs for writing unit tests.
Using Instruments to Detect Native Leaks using MarkHeap
This article describe how to use Instruments on any iOS device and any Xamarin.iOS application. It also looks at how to profile applications in the simulator.
Walkthrough - Using Apple's Instrument Tool
This article walks through how to use Apple’s Instruments tool to diagnose memory issues in an iOS application built with Xamarin. It demonstrates how to launch Instruments, take heap snapshots and analyze memory growth. It also shows how to use Instruments to display and pinpoint the exact lines of code that cause the memory issue.
There are many techniques for increasing the performance of applications built with Xamarin.iOS. Collectively these techniques can greatly reduce the amount of work being performed by a CPU, and the amount of memory consumed by an application.