My main goal is to open a browser link from the holoLens app. But opening a link directly from the HoloLens App using this code:
Application.Open(url)
this does open the link but it actually closes/resets the HoloLens application, opening it again just resets it from its start like it wasn't open at all.
I experimented something: manually minimizing the HoloLens app. -> open a holographic browser, -> browse -> and then go back to the HoloLens app. And this method works, the HoloLens app did not reset or close.
So I'm researching for how to programmatically minimize the app, then open a browser. I found this:
followed the instructions by using some references also:
the references basically say, in order to minimize the app. you will need to use this code:
#if !UNITY_EDITOR
using System.Threading.Tasks;
using Windows;
using Windows.Storage.Pickers;
using Windows.System;
#endif
#if !UNITY_EDITOR
IList<AppDiagnosticInfo> infos = await AppDiagnosticInfo.RequestInfoForAppAsync();
IList<AppResourceGroupInfo> resourceInfos = infos[0].GetResourceGroups();
await resourceInfos[0].StartSuspendAsync();
#endif
and you also need to declare appDiagnostics
in the built folder's .appxmanifest
file
There were 2 .appxmanifest
on the built folder located in:
G:\Unity Projects\Build\build\bin\ARM64\Release\AppX
and
G:\Unity Projects\Build\build\bin\ARM64\Release
I edited both .appxmanifest
just to be sure.
So when I run the application with the changes, and run the script.. nothing happens.
also they say to properly open a holographic browser you need to use this:
System.Diagnostics.Process.Start(url);
but this is not working also. right after I did the script that should minimize the HoloLens application I run this, and still nothing happens..
what am I missing?
If the system does not have the resources to keep your app in memory, it will terminate a suspended app in order to free up resources, even if you manually minimize the app, for more information please see:App Terminate
The best way to open some web links and avoid the system suspend your app is to launch a flat browser window directly inside your unity app. Please refer to this code:LaunchUri.cs. And have a look at launch browser example which shows the behavior in the HandInteractionExamples scene.