Home Development What’s new in Visual Studio for mobile development

What’s new in Visual Studio for mobile development


Visual Studio already has an Android emulator that runs on Windows, and an iOS simulator for Windows, but that works by connecting to a Mac and opening the simulator there. At the Build conference Microsoft unveiled Xamarin Live Player, a mobile app that lets you see your code running live on an iOS or Android device, rather than using an emulator. You pair the app with Visual Studio 2017 (from the 15.3 preview version on) or Visual Studio for Mac by photographing the QR code that appears on screen on the device you want to play code on, and then the IDE compiles the code you’re looking at to IL and sends that to the phone. As you edit your code, every time you stop typing for a few seconds, the current view gets updated and send to the phone; you don’t have to reload or save – the code automatically gets compiled and sent to the phone where you can see how well it works.

Despite the name, Live Player isn’t just for Xamarin.Forms apps (although that’s the focus for the first version which is available in preview; it supports all the iOS and Android APIs. It doesn’t replace needing a Mac for iOS developer or Java for Android development; you will still need an Xamarin environment with a Mac for the iOS tools, especially editing storyboards, or the Java and Google SDKs for Android development.

As Xamarin co-founder Nat Friedman explained to us, Live Player is trying to solve two specific problems, the initial barrier to becoming a mobile developer and the speed of seeing your app on a device. “As a mobile developer, you have to download gigabytes of SDKs to get started and if you want to deploy to an iPhone you have to understand provisioning profiles, you need to have certificates. And even once you’ve done all that and you’re building your app, the tweak-compile-deploy cycle has some really long steps in it where you’re compiling the package and deploying it. When you’re app is small that’s not to bad but as you start to use more frameworks, it starts to take a really long time – minutes in some cases. That’s OK if you’re making major changes but if I’m making tiny tweaks to the user interface – should I move this button, should I change this font size? – it’s just not tolerable any more.”

Pair your mobile device to Visual Studio by photographing the QR code and Xamarin Live Player lets you see your code running on the app in seconds

Seeing your app on a real device gives you a much better idea for how well it works, he points out. “Some apps get developed without ever being run on a device and then you run them right before you submit the app to the app store and it turns out your app is using a gigabyte of memory and devices don’t have that.”

New tools increasingly give developers playgrounds to experiment with your code; Friedman suggests thinking of Live Player as a playground for your app’s whole user interface, with all the complexities of networking and deployment taken care of in the background. What you get isn’t just the XAML though; Live Player runs the full context of the page you have open in Visual Studio, with all the data bindings. It also prevents some time-wasting mistakes; you can’t accidentally send the Android version of your app to your iOS device, or vice versa.

Visual Studio 2017 is also trying to address the issue of how long it takes to get started developing for mobile. If you pick the ‘Mobile development with .NET’ workload when you set up Visual Studio 2017, that automatically installs Xamarin – giving you the new Xamarin code IntelliSense completion engine and the Xamarin.Forms previewer that’s also in Visual Studio for Mac – but that doesn’t mean a long install time or a lot of space taken up on disk; Miguel de Icaza from the Xamarin team said at Build that the goal is to be able to install Visual Studio in five minutes and to be looking at your mobile app within another 60 seconds, rather than the 30-40 minutes it currently tales.

Forms and standards

If you’re building for mobile with C# using Xamarin in Visual Studio, Xamarin.Forms 3 will be in pre-release preview soon. This brings several rendering and performance improvements, plus better adaptive layout, and support for macOS, Tizen, GTK# (a Mono and .NET UI Toolkit that runs on UNIX as well as Windows and Mac) and WPF, so you’ll be able to build mobile apps that also run on Mac and Linux and Samsung wearables (and smart TVs), as well as Windows.

Xamarin.Forms 3 will also let you embed Xamarin content in a native iOS, Android or UWP app, so you can use Xamarin.Forms UI outside Xamarin.Forms apps. This is all simplified by the XAML Standard specification that’s now in development; a common vocabulary for describing XAML content across multiple platforms and frameworks.

Pushing notifications to a specific set of your users with Visual Studio Mobile Center

That’s not about sharing code between devices the way .NET Standard is, or about having the same user interface on multiple devices, as much as having a description of what’s in your user interface de Icaza explained. “Here’s what I need on my screen: I’m going to need the song list, the player buttons, the price of the item, the user comments, the user comments are going to be laid out like this.” Eventually, he suggested, “we want to get to a place where XAML Standard is a way of describing UIs generally”.

Microsoft also announced several new features for the Visual Studio Mobile Center service, which acts as a production CI/CD pipeline for iOS and Android (and by this autumn, UWP) apps from Visual Studio, with cloud test of your apps on real devices and detailed logs and performance results to help you find issues, and automated publishing into app stores, including making beta versions available to a specific group of users.

Mobile Center wraps several existing services, including the HockeyApp test and monitoring service. Existing HockeyApp users can keep using that service, but you can also see the same apps and tests in Mobile Center (HockeyApp Preseason users get that integration first and it will be available to other users in the coming months).

Mobile Center itself is getting a new push notification service that lets developers send targeted messages to specific groups of users. You can break your userbase up by carrier, device model, screen size, time zone and several other properties, so when you want to let customers now that there’s a new release they can update to, you can specify exactly who it’s relevant to so only they see the notification.

Find out more about how Grey Matter Ltd can help you with this subject. Send us a message:

By completing this form you are agreeing to our Privacy Notice.

Previous articleIs Visual Studio on the Mac really Visual Studio 2017 on Mac OS?
Next articleDebugging in Visual Studio
Mary Branscombe has been a technology writer for more than two decades, covering everything from early versions of Windows and Office to the first smartphones, the arrival of the Web and most things in between, including enterprise architecture and cloud services. She also dabbles in mystery fiction about the world of technology and startups.