Microsoft Surface Duo app dev setup, .NET MAUI and Uno Platform
By Mike Irving - Published: 19/8/2022

As a dual-screen device, the Surface Duo offers some interesting opportunities to software developers: How to leverage single screen, dual screen, the Surface Pen perhaps.

First and foremost, though, this is an Android device, and you'll need to make a few alterations to the device setup, common to all Android devices, before you begin app development.

 

Enable Developer Mode

Before you can deploy 'sideloaded' apps, whether for debugging purposes or apps from a 3rd Party App Store, you will need to enable Developer Mode on your device.

To Do this, open the Settings App and select the About screen.

Microsoft Surface Duo - Settings - About screen

Roll to the bottom of this screen until you see the 'Build number' section.

Microsoft Surface Duo - Settings - Build number

You need to tap the 'Build number' label repeatedly (around 7 times) to enable developer mode.

When you get near to the final tap, the device will let you know what you are about to do - 'You are now 3 steps away from being a developer.'

Microsoft Surface Duo - tapping Build number

Upon the confirmatory tap, this will change to read 'You are now a developer!'

Microsoft Surface Duo - You are now a developer!

Congratulations!

 

Developer Options

Next, we can confirm we have succcessfully enabled dev mode by going back a level in the Settings App, and selecting the System screen.

Microsoft Surface Duo - Settings

From the System screen there should be a new section 'Developer options'.

Microsoft Surface Duo - Developer options

Tap into this new section.

There are many options that you can toggle on / off and configure here, which you may find useful as a programmer.

Microsoft Surface Duo - Developer options - choices

Find the USB debugging section, and turn it on.

Microsoft Surface Duo - Allow USB debugging

You will be prompted to confirm this action, tap 'OK'.

Microsoft Surface Duo - USB Debugging on

Turn on any other features that you wish to use.

Microsoft Surface Duo - more developer options

For example, one I use regularly is Show layout bounds which shows how UI pieces are drawn on the screen. I find this useful when trying to debug layout anomalies.

Microsoft Surface Duo - Show layout bounds

There are many more options besides.

Microsoft Surface Duo - even more options

 

USB Preferences

In line with other Android phones and tablets, I found it necessary to set some USB preferences before the device was ready to accept sideloaded apps and allow debugging.

Search 'USB' in the system search, and you should be able to find the screen below.

When connected to a Computer by USB, you should set 'USB controlled by' to 'This device' and 'Use USB for' to 'File Transfer'.

Microsoft Surface Duo - USB Preferences

There is an alternative screen Default USB Configuration where you can set the default option to 'File Transfer'.

Microsoft Surface Duo - Default USB Configuration

If all goes well, then when you plug in to your computer with a compatible USB-C cable, you should see the 'Allow USB debugging?' prompt.

Microsoft Surface Duo - Allow USB Debugging?

Choose 'Allow' to continue, which will confirm the aforementioned settings.

(16)Microsoft Surface Duo - USB Settings

Brilliant, we are now development ready!

 

Example - Deploy a .NET MAUI App

Create a .NET MAUI App project in Visual Studio.

Make sure it builds, run dotnet restore etc, if necessary.

With the device connected via USB, from the ▶️ 'Deploy' dropdown, select 'Android Local Devices' and then your Microsoft Surface Duo device.

Visual Studio - Deploy .NET MAUI App to Microsoft Surface Duo

Hit Play / Press F5 and shortly afterwards the MAUI application should appear on the Duo!

.NET MAUI App on the Microsoft Surface Duo

 

Example - Deploy an Uno Platform App

Likewise, from Visual Studio, create a new Uno Platform application.

Make sure it builds, run dotnet restore etc, if necessary.

With the device connected via USB, from the ▶️ 'Deploy' dropdown, select 'Android Local Devices' and then your Microsoft Surface Duo device.

Visual Studio - Deploy Uno Platform App to Microsoft Surface Duo

Hit Play / Press F5 and shortly afterwards the UNO application should appear on the Duo!

Uno Platform App on the Microsoft Surface Duo

 

Two apps are better than one!

Move the apps from screen to screen, or run them side by side.

.NET MAUI App, Uno Platform App, side by side on the Microsoft Surface Duo

Turn some developer options on. Here, Show layout bounds.

.NET MAUI App, Uno Platform App, showing Layout bounds on the Microsoft Surface Duo

How about vertically stacked?

.NET MAUI App, Uno Platform App, vertically stacked on the Microsoft Surface Duo

Or full screen horizontal (drag app to the middle of the device).

.NET MAUI App, full screen horizontal on the Microsoft Surface Duo

Or full screen vertical (again, drag app to the middle of the device).

Uno Platform App, full screen vertical on the Microsoft Surface Duo

 

Amazing!

Fabulous, we can now deploy and debug apps with our Microsoft Surface Duo!

Thank you for reading my blog.

.NET MAUI App, Uno Platform App, side by side on the Microsoft Surface Duo - photo

 

Of course, these simple sample apps are limited to single screen (or full screen) at the moment. In a future blog we will look at utilising the dual screen capabilities of the device.


View Blog Entries...
Page: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11