There’s never enough time to get your work done, and stakeholder expectations are so much higher for mobile apps. Xamarin and Salesforce know your pain, and we’ve partnered to make your life easier. With our new Xamarin-Salesforce SDK, critical customer data can be added to your apps with just a few lines of code.

If you like to watch and listen instead of read, join me and Salesforce’s Josh Birk for a joint webinar on August 22, 2013 at 8:00 am Pacific / 11:00 am Eastern.

Before we dive into the Xamarin Salesforce Component (aka Mobile Pack), here’s a little background on Xamarin.

C# All the Things

Xamarin provides a .NET-centric platform for building native iOS and Android apps using C#. Enterprise developers leverage their existing talent, tooling, and code to build and deploy amazing apps quickly.

Xamarin exposes 100% of the native APIs for iOS and Android—anything you can do in Objective-C and Java can be done in C# with Xamarin. Since Xamarin uses native compilation, not interpretation, it runs at native speed.  With Xamarin, you can share on average 75% of your source code across device platforms and still deliver a fully native experience—the best of all worlds.

Developer Experience

Xamarin offers two compelling developer experiences: Xamarin Studio and Xamarin for Visual Studio. Xamarin Studio provides a professional-grade environment for building, testings, and publishing Xamarin iOS and Android applications, and runs on both OSX and Windows.

If you already have Visual Studio 2010 Professional or greater, and want work on your mobile apps from the comfort of your favorite IDE, our extensions for Visual Studio bring you the full Xamarin experience. You can develop iOS apps on Windows using either IDE, though you still need network access to an OSX machine in order to remotely build, debug, and deploy iOS apps. If you want to target Android only, then this requirement doesn’t apply to you.

Salesforce, with a Xamarin Twist

We heard many of you wanted faster, easier ways to integrate Salesforce data into your apps.  Salesforce heard you too, so we partnered together to create the Salesforce Component. Available in the Xamarin Component Store, this component allows you to authenticate, find and manage your Salesforce objects.

We not only ship the library and guides, we also ship a functional iOS and Android app that demonstrates how to use the cross-platform API. Let’s preview some of the things you’ll see when you add the component to your project.

Communicating with Salesforce

We focused on providing a lightweight library, keeping as little as possible between you and your data. Lightweight doesn’t mean limited, and even in our first release you can harness much of the power of the Salesforce REST API. Let’s look at some code, so you can see what we mean.

We focused on getting you up and running as quickly as possible. It doesn’t get much easier than this:

If your user has already authenticated within the last couple of days, then this line of code is all you need to start working with Salesforce data. If you user hasn’t authenticated before, or it’s been a while, then your user will need to let Salesforce know who they are, and give your app approval to use their data if they haven’t already.


Every time that the client communicates with the Salesforce REST API, it sends along a special token that identifies you allows Salesforce to confirm that the user sending the request is allowed to make that request. We manage this for you inside the client. However, if something goes wrong, the client will throw an InvalidSessionException so that you can take the appropriate action. You will likely want to initiate the first-time flow, let the user re-authenticate, and then retry the failed request.

If the user is launching your app for the first time, or it has been a few days, then they will need to provide Salesforce with their username and password. You kick of this process by making a call to the client to retrieve the Salesforce login UI, which runs inside of a browser control. We hide the complex OAuth protocol implementation details. The client will instead raise the AuthenticationComplete event allowing your code to resume execution–regardless of whether the user was successful or not. That information is provided in the custom EventArgs subclass passed to your event handler.

Query and Search

Now we are ready to fetch some data to display in your app. We make running SOQL queries as easy as a single line of code:

Searching for objects via SOSL is just as easy:

If you don’t need await and don’t want to deal with a return value of Task, we provide synchronous alternatives that still return IEnumerable<SObject>.

Add, Update, and Delete

Modifying SObjects follows the same easy pattern:

So, there you have it: easy Salesforce integration with your Xamarin mobile apps.

Want to learn more? Have questions? Join me and Salesforce’s Josh Birk for a joint webinar on August 22, 2013 at 8:00 am Pacific / 11:00 am Eastern.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS