Sunday, March 12, 2017

… and You Can Write HoloLens Apps in macOS / Linux Too (Part 3: Deploy to HoloLens)

In Part 1 we saw how to set up a cloud server to build Unity apps for HoloLens, and Part 2 covered how to set up a Unity HoloLens project to build in the cloud. Now we’ll look at how to get the compiled code up to the HoloLens.

One-Time Setup

To get set up to push app bundles to the HoloLens, you first need to set up the HoloLens to use the Windows Device Portal. This is a web server on the HoloLens that lets you connect and manage the HoloLens from a browser outside the device.
You set up the device portal from within the HoloLens, using the Settings app. Select the “Update” menu item and then the “For developers” menu item. Enable “Developer Mode” and then scroll down and enable “Device Portal”.

Accessing the HoloLens Via Browser

Make sure the HoloLens is connected to WiFi (make sure it’s a secure WiFi that you trust), and then look up its IP address by going to “Settings > Network & Internet > Wi-Fi > Advanced Options”.
From a web browser on a development machine in the same WiFi network, go to https://[HOLOLENS_IP_ADDRESS] .
The first time you connect, the browser should tell you that there’s a problem with the website’s security certificate. Assuming you’re on a WiFi that you trust, ignore this for the time being (we’ll fix it later).
The first time you connect, you’ll also need to create a username and password. When you connect, the first page you see should be the “Set up access” page. Click or tap “Request pin” — then if you look at the HoloLens display, you’ll see a PIN number that it generated that you should enter into the “PIN displayed on your device” textbox. After that, you can enter a username and password of your choice (the password has to have at least seven characters).  Then click “Pair” to connect to the Windows Device Portal on the HoloLens.1
Now you can fix the certificate issue. Go to the “Security” page on the Device Portal, either by clicking the “Security” link from the top right icon list or by navigating to: https://[HOLOLENS_IP_ADDRESS]/devicesecurity.htm. From that page you can download the device’s certificate.
If you’re on macOS, you’ll need to add a .p12 extension to the certificate name. Then you can double-click it and it will install into your keychain. Next, double-click it in the keychain and next to “Secure Sockets Layer (SSL)” select “Always Trust”.
If you’re on Windows, from the “Run” app, type “Manage Computer Certificates” and start the applet. Expand the “Trusted Root Certification Authority” folder, and click on the “Certificates” folder. Then, from the Action menu, select: “All Tasks > Import…”  Once you complete the Certificate Import Wizard using the downloaded certificate file, you will have installed the certificate in the Trusted Root Certification Authorities store on your local machine.
(I’m not sure what needs to be done on Linux; if someone fills me in I’ll add it here.)
You’ll need to restart your browser for it to recognize the imported certificate.

Deploying Your App To the HoloLens

Now in the Windows Device Portal, click “Apps”. Under “Install App” you can select your app bundle: Click the “Choose File” button under “App package” and navigate to the network share from the remote build server, and drill down under the AppPackages directory under the solution directory of your IL2CPP build. You want the file named after your project with the extension .appxbundle.
Then under “Deploy”, click “Go” to deploy the app package to the HoloLens.
It’s as easy as that!

[This piece was originally posted here.]

1 If you want to change the username or password later, you can visit the device security page by either clicking the Security link along the top right, or by navigating to: https://[HOLOLENS_IP_ADDRESS]/devicesecurity.htm .

No comments:

Post a Comment