It is 2017, and it is almost criminal to say that your app doesn't work on a given mobile platform. This means, most mobile developers are building cross-platform apps. Xamarin has helped democratize cross-platform mobile development for .NET developers. You get world-class IDEs and tooling to build your Xamarin apps on any platform.
But deploying apps to devices remains tricky - developers often have to deal with native platform SDKs, varying OS versions and device provisioning. It's a pain to get your cross-platform app running on your device!
At Microsoft BUILD this year they announced Xamarin Live Player, which aims to ease some of this pain of deploying apps to devices. Is it the panacea for seamless app deployments across all mobile devices?
While Xamarin Live Player may just be getting started, the promise is there for sure. This article explores Xamarin Live Player in all its glory and some fallacies. The age of easy mobile app deployments is upon us.
What is it?
Xamarin Live Player promises seamless deployment of Xamarin apps to iOS and Android devices. The goal is to enable faster developer workflows - develop, deploy, test, change, re-deploy and debug - all on your personal iOS/Android device without any hassles or provisioning. You can get started today at xamarin.com/live. There is also a dedicated Xamarin Show episode that can help you get going with Xamarin Live Player.
This promise is not new for cross-platform apps though, just rather complex to pull off given the sheer variety of mobile devices. It is interesting to note that developers using web technologies to build cross-platform mobile apps - both hybrid or native - have had such device deployment tools for a while - the notable ones being Telerik AppBuilder LiveSync and Ionic LiveReload.
One may argue however, that hardcore .NET developers wanting to build mobile apps in C# have never had such luxuries. This is where Xamarin Live Player steps in - bringing continuous deployment and debugging to most iOS/Android devices for Xamarin apps.
Want to get started? The first call to action is to get the Xamarin Live Player apps, available conveniently in the Apple iOS and Google Play stores.
Go ahead, and download the app on your respective phone (as seen on my iPhone above). Note that two of the most prolific Xamarin developers, James Montemagno and Frank Krueger, have had their hands in the Xamarin Live Player app, so you will not be disappointed. Also as a shoutout, James and Frank do this awesome developer podcast called Merge Conflict - give it a listen on your next long drive.
The Xamarin Live Player app doesn't have fancy UI and doesn't do much out of the box - the magic is what happens under the hood. The Live Player app is meant to be paired to your Xamarin development IDE - Visual Studio on Windows or Mac - running on a machine over the same WiFi network as your phone. Once paired, the Xamarin Live Player becomes a shim that can seamlessly run your Xamarin apps inside, just as if running on the device as a native app. You get to deploy apps through the Xamarin Live Player onto your devices completely wirelessly - how cool is that? Your code never gets sucked up to any cloud servers - just a quick exchange of bits over WiFi between your IDE and the Xamarin Live Player app.
How does it work?
So you may be wondering how the Xamarin Live Player works and what it takes to deploy your Xamarin apps to your phone. Xamarin Live Player can act as a shell that runs your Xamarin apps on iOS and Android - this works for Xamarin.Forms as well as native UIs in Xamarin iOS/Android.
On first launch, Xamarin Live Player will tell you it needs to be paired with a Visual Studio instance running on a computer on the same WiFi network.
The first step towards getting Xamarin Live Player working is a little handshake - a pairing between the app running on your phone with the corresponding Visual Studio instance, running on either Windows or Mac. In the Xamarin Live Player app, go ahead and start the 'Pair to Visual Studio' process - the app gets into a camera mode to scan a QR code and also shows a unique access code for VS pairing. Then in your Visual Studio IDE, choose the Xamarin Live Player configuration wizard (from Devices list) to pair to the Xamarin Live Player app running on phone in the same wifi.
The pairing screen presented by Visual Studio gives you two choices - either scan the generated QR code from your Xamarin Live Player app or simply punch in the access code from the app into Visual Studio. That's all the handshake it takes to pair the app with Visual Studio. Visual Studio can now 'see' your Xamarin Live Player running phone and lists it as just another device for deployment. Already paired iOS and Android devices show up in the pairing screen and you can choose between any. The Live Player app says, "I'm ready, just fire away from inside of Visual Studio."
The whole point of Xamarin Live Player is easy deployment of Xamarin apps to iOS/Android devices for seamless debug/test experience from inside Visual Studio. Once the app and IDE have been paired, you should be all set to get in the groove of easy deployments as you are coding - just point to the Live Player from Visual Studio, as seen here in my VS for Mac.
If you want to try out the Xamarin Live Player from a pre-built app first, there are several samples out there. Here's the ColorControl app running on my iPhone through the Xamarin Live Player.
Once the Xamarin Live Player has been paired with Visual Studio and your app is running on the device, subsequent deployments become easy - just hit run from Visual Studio and your Xamarin code is continuously deployed through the app. And yes, you can debug and hit breakpoints in your code as your app is running in the Xamarin Live Player.
Deploying apps to device after a full build? That's just the basics - what you want is a even more seamless development/debugging experience. What you need is live edits - make continual changes to your code and see it reflected right away in the app running on your device. Xamarin Live Player obliges with a special continuous run mode - the Live Run View.
The idea is that the continuous run mode is per page - you enter it when you want to fiddle around with code on a given Xamarin UI page. The apps's navigation is hidden away and you get to focus on one page at a time. Go ahead and change some XAML markup or even code behind - save your changes and The Xamarin Live Player app seamlessly picks up the code changes that you have made to a given page and the app refresh shows your changes running. Do this continuously and you can see how it becomes an incredibly handy tool to perfect one UI page at a time - update and run your code live.
Is this all sounding a little too good to be true? Well, for the most part, Xamarin Live Player delivers on the promises - but keep in mind, this is still V1 for the product. If you're having a hard time making Xamarin Live Player work for your app, device and IDE, stay calm and read on to make sure you're not running up against known caveats.
Xamarin Live Player is very new to this game and you are dealing with pre-release software here. While the iOS/Android apps are easy to get from the respective stores, the Visual Studio integration bits are for preview only. If using Visual Studio for Mac, you need to switch to the Alpha channel for the latest bits. If you're on Windows, you'll need Visual Studio 2017 15.3 Preview with the Xamarin Updater installed to get the latest updates that include Xamarin Live Player support.
Xamarin Live Player has some requirements on the mobile OS front and has a list of supported devices, albeit all modern phones included. For iOS, you'll need iOS 9 or later installed on iPhones or iPads - please check app store listing for compatibility. For Android, you'll need 4.2 and up - again check app listing for support.
App size restrictions
There are some app package size limitations with the Xamarin Live Player app.
While Xamarin Live Player makes it easy for you to deploy your Xamarin apps to iOS/Android devices, some app customizations are just not possible to test - remember, your app is running inside a shell. These customizations include app icons, splash screens, app extensions and custom widgets. There is also limited support for iOS Storyboards and code reflections.
You still need a Mac
So developing iOS apps through Xamarin has always necessitated the presence of a Mac on the network or in the cloud - the app package for the store has to be built through XCode running on a Mac licensed to the corresponding developer. Xamarin Live Player does a good job of taking the Mac out of the picture for regular development/testing/debugging cycles - you can deploy directly to your iOS devices from Visual Studio. But once your app is ready, you would still need the Mac to build the final app package. Also, apps running inside the Xamarin Live Player are functioning under a wrapper shim - you would eventually want to test true app performance on iOS by doing real deployment through a provisioned device and licensed XCode.
No custom renderers
This may trip you up in case you haven't read the docs carefully. Xamarin Live Player, as of now, does not support custom UI renderers for Xamarin.Forms or Xamarin.iOS/Android. If you have had to dip into native platform UI from your app through a custom renderer, this will likely be a stumbling block.
Also to note, most 3rd party UI libraries often use custom renderers for polished native UI controls - these would trip up the Xamarin Live Player as well. So stay calm, use device simulators and be patient for updates to the Xamarin Live Player.
Are We There Yet?
You may ask: Is the Xamarin Live Player ready for primetime yet? Well, the answer is yes and no. One can clearly see the promise of Xamarin Live Player - seamless Xamarin app deployment to iOS/Android devices for continuous core development, debugging and testing cycles. But being in the first wave of product iteration, Xamarin Live Player clearly has some shortcomings. If they are dealbreakers for you, continue what you are doing now for Xamarin app testing and wait for a better future. We developers need not be so cynical - tomorrow still looks to be glorious.
Doing cool mobile app development with Xamarin? Your app will invariably benefit from polished performant UI controls - take a look at Telerik UI for Xamarin and get a free trial to play around. Truly native, truly cross-platform rich UI controls for all your Xamarin apps - your dream app needs good UI.