Introduction to Xamarin

Mobile Development on iOS and Android with C#

Follow along @ http://fammy.github.io/xamarin

Jason Famularo

jason@famularo.org or @splodn

Stop me and ask questions! (Although I may save them for the end)

Who and what is Xamarin and what do they do?

Mono - cross platform, open source .NET development framework

Mono allows .NET code to run on non-MS devices, such as...


Mac, Linux, BSD, iOS, Android, PlayStation 3 and 4 and Vita, Wii


...and so on


If you are interested in making games with Mono, check out the excellent MonoGame.

Who and what is Xamarin and what do they do?

Xamarin Platform

Takes code written in C# (or F#) and runs it on a Mono runtime or compiles to native code

Xamarin.iOS iPhone, iPad, and iPod Touch
Xamarin.Android Android phones, tablets, watches, TVs, Google Glass, Kindle Fire phone and tablets (and Blackberry 10 via Android compatibility, and Ouya and other Android game consoles, and that weird Nokia X line)
Xamarin.Mac Macintosh computers by Apple, Inc.
Xamarin.Forms Native UI for iOS, Android, Windows Phone with a single codebase
Test Cloud Automated testing on hundreds of devices

Why should I care about the Xamarin platform?

  • Write in a common, modern language developers (may) already know
  • Reuse code on multiple platforms
  • Use Visual Studio (2010+) or the free Xamarin Studio
  • Many companies claim 60%, even 80% shared code. 95%+ possible with Xamarin.Forms
  • Commercial product with support - important for businesses (and governments)

Also comes with a very commercial price.

What's the solution?

  • Use Visual Studio or Xamarin Studio (or Sublime or Notepad and command line compiler, if that's your thing)
  • Write against native APIs, mapped to C#. APIs are (mostly) C#-ified
  • You write C# code and it gets compiled to native code (Mac, iOS, Android) or runs on Mono runtime (Mac, Android)
  • Many popular libraries already run on Xamarin or can be compiled with little modification (if open source)
  • Still need to be able to read Java, Objective-C (and soon Swift)
  • Use (most) popular native libaries via "bindings"

How do I get started?

  • Download the Business plan free trial -- which will turn into the Starter plan after 30 days (90 days if you are an MSDN customer).
  • Starter edition limited in app size and cannot link to external libraries, components
  • Download one of the prebuilt apps from Xamarin or File->New Project if you are brave

Want to get a free shirt by checking out Xamarin?

https://xamarin.com/c-sharp-shirt

Enough slides, show me some code


 protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.LoginLayout);

            // Get our controls from the layout resource,
            // and attach an event to it
            login = FindViewById<Button> (Resource.Id.logIn);
            userName = FindViewById<EditText> (Resource.Id.userName);
            password = FindViewById<EditText> (Resource.Id.password);
            progressIndicator = FindViewById<ProgressBar> (Resource.Id.loginProgress);
            var loginHelp = FindViewById<ImageButton> (Resource.Id.loginQuestion);

Questions?

Ask away!

Want more info?

Head to Xamarin.com or stay tuned to Technology Grows for more exciting courses


Jason Famularo

jason@famularo.org or @splodn