Getting Started > AirWatch SDK Setup (Xamarin Android)

Download file:
Sample Code

Overview

This document describes how to integrate the AirWatch Xamarin Android SDK into an existing Xamarin Android application.

Important: You will need to download the SDK binary separately via https://components.xamarin.com/view/awsdk.

Requirements

  • The AirWatch Xamarin Android SDK, AWClient-SDK.dll.
  • The AirWatch debug Java keystore, android_airwatch_debug.keystore, or another keystore that contains a key that can be used to sign applications for the AirWatch Console.
  • Xamarin Studio – if you have Visual Studio with the Xamarin plugin, this should also work, but this document is based on Xamarin Studio.
  • A Xamarin Android app into which you want to integrate the Airwatch SDK. If you do not have a suitable application, you can create a new application in Xamarin Studio and integrate the SDK into that.

Tutorial

Step 1: Whitelist Signing Key

Before you can begin using the SDK, you must ensure your application signing key is whitelisted with your AirWatch Admin Console. When your SDK-integrated application starts up, the SDK contacts the AirWatch Console and sends the public key with which it is signed. The Console compares that key with the one it has whitelisted to determine whether your application is trusted.

AirWatch allows whitelisting for apps deployed internally or deployed through a public app store.

Internally Deployed Applications

  1. Sign an APK file with the debug AirWatch keystore. The alias of the key to be used is androiddebugkey, and password to both the keystore and the key is android. app_signing
  2. Upload the APK file to the AirWatch Admin Console. The AirWatch Admin Console extracts the application’s public signing key and adds it to the whitelist.

Publicly Deployed Applications

For applications that are deployed publicly through the Play Store, send the public signing key of the application to AirWatch for whitelisting.

Note: Contact your professional services representative for the process of whitelisting the public signing key.

Step 2: Push App to Dev Device using App Catalog

In order for the AirWatch Agent to manage an app, it needs to be sent to the device. This can be done via an installation policy of Automatic or by pushing the app down once using the Agent‘s APP CATALOG. Once the app is listed in the Managed Apps section of the Agent, it is ready for local management.

managed_app

Step 3: Integrating the Client SDK

Add the SDK to the Project

In order to use the client SDK, add the AWClient-SDK.dll to your project References:

edit_references

Here’s how it looks in the sample project:

final_references

Initialize the SDK

Basic SDK Integration is very simple. At the most basic level, the developer needs to interact with one class, the SDKManager. A common use would be to call SDKManager.Init (activity) followed by another SDK API, such as SsoSessionReturnCode code = SDKManager.ValidateSSOSession (activity) within a background thread in the OnResume () method of your activity.

Important: Before using any SDK API’s in an Activity, make sure to initialize the SDK with SDKManager.Init (activity). Besides using a helper class such as the example in the Passcode implementation, this can be done in the Activity by calling SDKManager.Init (activity) on itself.

using Android.App;
using Android.Widget;
using Android.OS;
using System.Threading.Tasks;
using Com.Airwatch.Sdk;

namespace SDKSampleAppAndroid
{
	[Activity (Label = "SDKSampleApp", MainLauncher = true, Icon = "@mipmap/icon")]
	public class MainActivity : Activity
	{
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.Main);
		}

		protected override void OnResume ()
		{
			Task.Run (() => {
				SDKManager.Init (this);
			});
		}
	}
}

You can then move on to use another SDK API once the initialization has been completed successfully.

Debug your Application

Your application is now integrated with the SDK! Once you call the init method, the SDKManager should gather the required API permissions to use any subsequent Client SDK functionalities.

Note: In order for the SDK to initialize successfully, please make sure that you have first sent down a managed version of the application down to your test device. See the Getting Started section for more information.

Next Steps

Once the SDK setup is completed, move on to the next SDK sections to implement the feature specific logic.

+

Questions? Comments? Leave them for us here.