On Windows? Try the Visual Studio 2017 walkthrough.
Install the Xamarin Live Player App
- Download the Xamarin Live Player App to your mobile device:
Alternatively, use a QR code reader to scan the following QR code from your device to open the Xamarin Live Player in the Google Play store:
- Ensure that your mobile device and Mac are connected to the same Wi-Fi network.
Let's Get Started
In this walkthrough, you'll pair your Android device to Visual Studio for Mac. Once your device is paired to the IDE, you'll learn how to launch an app on your device using the Xamarin Live Player. You'll also learn how to use the Live Run Current View feature to display the current XAML page on your device, and will get a chance to edit the XAML and see it appear instantly.
- First, download the XamagonXuzzleLP sample.
- While the sample is downloading, enable the Xamarin Live Player in Visual Studio for Mac. To do this go to Visual Studio > Preferences… and select Projects > Xamarin Live Player (Preview). Then select the Enable Xamarin Live Player checkbox:
- Locate the downloaded sample and double-click the .sln file to open it in Visual Studio for Mac:
- Pair your mobile device and Visual Studio for Mac. To do this both devices must be on the same Wi-Fi network. Once you have ensured both devices are on the same network, select Tools > Manage Live Player Devices… from the menu bar:
- Open the Live Player app on your mobile device:
- Press the PAIR LIVE PLAYER button in the Live Player app:
The app will open a camera viewfinder for you to scan the QR code displayed in the Manage Live Player Devices dialog.
- Scan the QR code, or enter the code in Visual Studio for Mac to complete the pairing process:
- Once your device has been successfully connected, you are ready to deploy the app. Set the device configuration to XamagonXuzzle.Android | Debug and select your device under Live Player from the configuration list. Press the triangular run button to run your app:
- Play with the app on your device, try and put the Xamagon back together!
Live Run Current View
Now that you have launched an app to your device with the Xamarin Live Player, the next steps is to start changing code and see those changes appear instantaneously.
This section introduces the Live Run functionality, which allows you to edit the user interface and see it appear on your device.
- Before you begin, make sure that your device is still paired to Visual Studio for Mac. To do this, open the device list. If your device name has (unreachable) next to it, try the pairing process again:
- Set the device configuration to XamagonXuzzle.Android | Debug and select your device under Live Player from the configuration list.
- From the XamagonXuzzle Project, double-click MainPage.xaml to open it in the code editor:
- To run this XAML page as a live view on your device, select Run > Live Run Current View from the menu bar:
- You can now start editing the XAML and see it appearing instantaneously on your device. For example try the following example to change the background color, or try your own! Find this line of code and change the
BackgroundColorto your favorite color:
<AbsoluteLayout x:Name="absoluteLayout" BackgroundColor="Black" />
- When you are happy with your XAML layout, run the app to see the user interface updates in the context of the entire app.
This walkthrough is designed to show you how to use Visual Studio for Mac and the Xamarin Live Player to launch an app on your device. It also shows how you can use Xamarin Live Player to launch single XAML pages of your app, allowing you to rapidly prototype your user interface.
The next page shows some additional samples that can be used with your Android device and the Xamarin Live Player.
If you have issues with the Xamarin Live Player, check out the Troubleshooting guide for additional help.