Microsoft Surface Duo app dev setup, .NET MAUI and Uno Platform
A Blog from Mike Irving, Software Developer
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.
Roll to the bottom of this screen until you see the 'Build number' section.
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.'
Upon the confirmatory tap, this will change to read '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.
From the System screen there should be a new section '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.
Find the USB debugging section, and turn it on.
You will be prompted to confirm this action, tap 'OK'.
Turn on any other features that you wish to use.
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.
There are many more options besides.
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'.
There is an alternative screen Default USB Configuration where you can set the default option to 'File Transfer'.
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.
Choose 'Allow' to continue, which will confirm the aforementioned settings.
(16)
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.
Hit Play / Press F5 and shortly afterwards the MAUI application should appear on the 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.
Hit Play / Press F5 and shortly afterwards the UNO application should appear on the Duo!
Two apps are better than one!
Move the apps from screen to screen, or run them side by side.
Turn some developer options on. Here, Show layout bounds.
How about vertically stacked?
Or full screen horizontal (drag app to the middle of the device).
Or full screen vertical (again, drag app to the middle of the device).
Amazing!
Fabulous, we can now deploy and debug apps with our Microsoft Surface Duo!
Thank you for reading my blog.
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