Bringing Your Universal Windows Apps to Microsoft HoloLens

The Universal Windows Platform (UWP) enables one app to run on every Windows devices running on Windows 10 – could be a desktop, tablet, Phone, Xbox, IoT device like Raspberry Pi2 or even on Microsoft HoloLens. That means that all the Universal Windows Platform (UWP) apps built for phone or desktop /devices can work on HoloLens too. These will be projected and rendered on a 2D surface.

This is a great way to start your development with HoloLens when you are coming from a Device App Development background.  By brining your Universal Windows apps to HoloLens, you can run the apps beyond the screen and introduce a hands-free computing with it.  You can start using Gaze, gestures, voice command to interact with you apps.

To getting started, please follow my previous article Start Building Holographic Apps with Microsoft HoloLens and setup your development environment first.

Start Building Holographic Apps with Microsoft HoloLens

Make sure you have following components installed.

Then start a new Windows Universal Apps Project from File –> New Project dialog window, given a name say ” WorldMap” and click on OK.

Create new Universal Windows Project
Create new Universal Windows Project

If you are familiar with Universal App. Development, the solution structure will be known to you. It will remain same and no changes in the solution structure.

Universal Windows Project Solution
Universal Windows Project Solution

At this point, without doing any change in the application you can start running the app using HoloLens Emulator.

HoloLens Emulator
HoloLens Emulator

Select the HoloLens Emulator option from the list of devices / emulator and then run your applications.

Running UWP in HoloLens Emulator
Running UWP in HoloLens Emulator

At this point of time you can drag, move the controls using you’re the Gaze and Tap the application to place your app.

Well, lets close this emulator and back to the Visual Studio Solution. Map Controls in Windows 10 Universal Apps are much more easier and makes app developers life simpler. Let try to place a map control in the app and provide an 3D View for the same.

Open the XAML page and add the following two highlighted line.

UWP Map Control
UWP Map Control

With respect to code  behind, add the following line of code to enable the 3D Maps.

Tip : 3D Rendering of MapControl in Windows 10 Universal App Development

UWP Map Control - 3D
UWP Map Control – 3D

So far, this is nothing but an Universal App, which has a Map Control. Now if we run this app either on Windows 10 desktop, tablet or even in Windows 10 Mobile, it will run as it is.

UWP World Map running on Windows 10 Device Simulator and Windows Phone 10
UWP World Map running on Windows 10 Device Simulator and Windows Phone 10

Similarly, now select the “HoloLens” emulator and run the application from Visual Studio. The application would start running as it is in your HoloLens Emulator.

UWP World Map running in HoloLens
UWP World Map running in HoloLens

To move the app with in the view port, you can target the app using “Gaze” gesture and cursor follows your head movement.  You can then place the a[  by “Airtap” feature and play around with the app.

Gaze
Gaze

To take an deeper look, Open the Device Portal and navigate to “3D View’’ tab, which can give you an overall 3D movement with respect to the plane along with app and the view port.

Live 3D View of App
Live 3D View of App

You can take help of Select Tool, Drag Tool and Zoom Tool from the emulator to simulate real device features.

Tools
Tools

Move the Gaze ( By following the Cursor), it will highlight the control and then press enter to select it.  For an example, select the Zoom Tool and then you simulate the Zoom feature using the emulator.

image

Zooming the Map using Zoom Tool
Zooming the Map using Zoom Tool

When you want to run your UWP app in HoloLens, you must consider the new inputs possibilities to control your app specific feature for an example selecting, moving, zooming with in the app.

Consider new Input Possibilities with Gaze, Gesture, and Voice

The HoloLens emulator is power full, and you can test holographic apps on your PC.  The action in emulator simulates the real world inputs. Here is the couple of main actions for HoloLens emulator.

  • Walk forward, back, left, and right – Use the W,A,S, and D keys on your keyboard, or the left stick on an Xbox controller.
  • Look up, down, left, and right – Click and drag the mouse, use the arrow keys on your keyboard, or the right stick on an Xbox controller.
  • Air tap gesture – Right-click the mouse, press the Enter key on your keyboard, or use the A button on an Xbox controller.
  • Bloom gesture – Press the Windows key or F2 key on your keyboard, or press the B button on an Xbox controller.
  • Hand movement for scrolling – Hold the Alt key, hold the right mouse button, and drag the mouse up / down, or in an Xbox controller hold the right trigger and A button down and move the right stick up and down.

Reference :  Using the HoloLens emulator  | Advanced emulator input

HoloLens: Building UWP 2D Apps for Microsoft HoloLens

Build Event Video on 2D UWP Apps for Microsoft HoloLens
Build Event Video on 2D UWP Apps for Microsoft HoloLens

Key Points :

  • To build an app for HoloLens, you must target the Universal Windows Platform

Validate your Package.appxmanifest has following entry.

Universal Windows Platform Target
Universal Windows Platform Target

Reference Study :

Building 2D apps for Microsoft HoloLens

HoloLens , ,