Building xamarin-enhanced azure mobile sites SDK source code (Xamarin Auth)


It appears that some of the best learning experiences about microsoft/xamarin mobile coding strategies come from building the test applications distributed, in source code, with the azure mobile site’s client SDK source.

On attempting to build the mobile SDK from source – when augmented with the xamarin.auth library (sources) – one runs into an initial problem:

image

image

 

Like good little non-exceptionals we might choose to bow and beg for the same information available to Americans (whose exceptionalism is set to be induced mostly because they get to use local networking and context setting that unhinders access to “ahem” things that are gotchas for the rest of us). Nothing like a bit of covert, denied and of course rather negative bias – to define exceptionalism. But we don’t.

So we use visual studio’s git client to download a repository for the xamarin auth library – having noted that the microsoft open source code expects it to be placed in

C:\Users\pwilliams\Source\Repos\azure-mobile-services\sdk\Managed\src\External\Xamarin.Auth

(on my system).

image

https://github.com/xamarin/Xamarin.Auth.git

 

So we do this:

image

image

On a build host onto which xamarin studio and its visual studio integration kits have been installed and proved working when building and deploying android apps, then the android test build goes as this:

image

we get

 WP_20140604_15_58_02_Pro__highres[1]

To this, we modify the provider so we  can invoke our AAD tenant:

private async void OnClickLogin(object sender, EventArgs eventArgs)
{
    var client = new MobileServiceClient(this.uriText.Text, this.keyText.Text);
    var user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory);
    System.Diagnostics.Debug.WriteLine(user.UserId);
}

So that the app can access the internet resources (for such as javascript and our IDP), we add a manifest with internet permissions:

WP_20140604_16_28_47_Pro__highres[1]

<?xml version=”1.0″ encoding=”utf-8″?>
<manifest xmlns:android=”http://schemas.android.com/apk/res/android”>
  <uses-permission android:name=”android.permission.INTERNET” />
  <uses-permission
android:name=”android.permission.ACCESS_NETWORK_STATE” />
  <uses-permission android:name=”android.permission.GET_ACCOUNTS” />
  <uses-permission android:name=”android.permission.MANAGE_ACCOUNTS” />
  <uses-permission android:name=”android.permission.USE_CREDENTIALS” />
    <uses-sdk android:minSdkVersion=”8″ android:targetSdkVersion=”8″ />
    <application></application>
</manifest>

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in AAD, azuremobile. Bookmark the permalink.