Twilio Client for Xamarin – Part 1: Introduction

Once upon a time, mobile application development required separate teams working on apps for iOS, Android and Windows Phone. There was very little code or skill sharing between these teams. You built an app for iOS in Objective-C then rebuilt the app for Android in Java and then potentially one more time for Windows Phone using C#. This siloed approach is very unproductive and expensive. Parts of the application that could easily be reused have to be rewritten to support another platform.

Xamarin burst on the scene in 2011 and completely changed the mobile development landscape. With Xamarin you are able to build fully native cross-platform mobile applications using the C# language. Xamarin makes 100% of the APIs on iOS and Android available to C# developers. It is a truly no compromise solution. If you can build it in Objective-C or Java you can build it with C#.

Xamarin Code Sharing

It is in this spirit of no compromises that I am extremely excited to bring Twilio Client for Mobile support to Xamarin developers in the form of a Twilio Client component for the Xamarin Component Store. By adding a few lines of code your iOS or Android application will be able to call any phone on the global telecom network as well as other instances of the same app directly using VoIP.

This post is the first in a series on using Twilio Client in Xamarin applications. In this post I will show you how to add the Twilio Client component to your application and point out a few resources to help you get started. Upcoming posts in the series will walk through building full-featured Twilio Client applications for iOS and Android.

For now let’s start with adding the component and taking a look at what resources are available in it.

Adding Twilio Client to your Xamarin app

Before you get started you will need to make sure you have a Xamarin Indie, Business, or Enterprise license. This is a requirement for using the Xamarin Component Store. If you don’t have a license yet you can start a 30-day Business trial.

The Component Store makes it really easy for you to add Twilio Client’s VoIP capabilities to your Xamarin applications. To add a component to your iOS or Android project, right-click on the Components node under the project and click Get More Components… to launch the Component Store.

Get More Components

Type “Twilio” in the search box in the upper-left to find the new Twilio Client for Xamarin component.   Once the component appears click on it in order to view the component details.

Search Component

Within the component details view click the Add to App button.  The component will be added to the project along with all of the necessary references needed to make it work:

Twilio Client Component

Once the installation completes it will display the contents of the component:

Component Details

The first thing displayed is the Getting Started page. This tutorial will walk you through building a sample application which turns your iPad or Android tablet into a phone. Additionally a sample project is included with the component for both iOS and Android that shows how to use all of the features included in the Twilio Client SDK. If you want to try out the sample you can find it on the Samples tab inside the component. The Assemblies tab lists the assembly that was added to the project (TwilioClient.iOS or TwilioClient.Android) by the component.

What next?

In this post I introduced the new Twilio Client component for Xamarin and showed how easy it is to add to your Xamarin application. In the next post I will show you how to setup the server side code that will be necessary to make our Twilio Client application app work. If you want to get a head start on this, all of the server code we will be building is detailed in the Getting Started guide that comes with the component. I’m excited to see what you build. Hit me up on Twitter @brentschooley if you run into any problems getting started.