Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Opening other application from script on HL2

Discussion in 'AR' started by Arkonis_Khobalt, Sep 21, 2020.

  1. Arkonis_Khobalt

    Arkonis_Khobalt

    Joined:
    May 11, 2017
    Posts:
    11
    Hello guys, I'm working on a pretty simple app for Hololens 2 in which use button prompt to open 2 applications.
    One is an appxbundle I have in my StreamingAssets folder, and the other one is Dynamics365Guides which is already installed on the device.
    So far I tried to launch the appxbundle file with the Application.OpenURL method and the Windows.System.Launcher.LaunchUriAsync method, none of which are successful.
    And I did not even try to open the Dynamics365Guides since I don't know how to get the path to installed apps.

    So if anyone can shed some light on this suject I would be very grateful :)
     
  2. Arkonis_Khobalt

    Arkonis_Khobalt

    Joined:
    May 11, 2017
    Posts:
    11
    In case anyone ever faces the sam problem, here is the working solution Microsoft support gave me.
    Apps are sandboxed on Hololens, so opening anything outside what's contained in the package is not possible (so opening an app with its .exe URL is not an option).
    UWP apps (which is the target platform for HL apps) can register an URI handler which allows them to be launched by passing said URI to the system.
    On principle every Microsoft app should already have this handler (you can get it by watching which protocol are registered when the app opens), and for your own app you have to add the URI scheme to the package manifest, and add a tiny bit of code to handle this special startup.

    Opening an app this way is done throught LaunchUriAsync, but it has to be called on the Windows UI thread, so the full method to launch the app is as follows :
    Code (CSharp):
    1. #if !UNITY_EDITOR
    2. string uriToLaunch = @"ms-guides://"; //Dynamics365guides URI
    3. System.Uri uri = new System.Uri(uriToLaunch);
    4. await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
    5. {
    6.     await Windows.System.Launcher.LaunchUriAsync(uri);
    7. });
    8. #endif
     
    Holo-Light and StefHun like this.
  3. StefHun

    StefHun

    Joined:
    Dec 3, 2020
    Posts:
    3
    Thank you!!!
     
  4. komalsharma21294

    komalsharma21294

    Joined:
    Nov 5, 2018
    Posts:
    4
    @Arkonis_Khobalt
    I am trying to use Dynamic 365 remote assist app to share my mixed reality app (built in Unity) to users on Microsoft teams. My app is using Vuforia for image target detection. Problem is, both remote assist and my app requires the camera at the same time. Seems like, while my camera is "On" on remote assist app, my image target is not getting detected. Hence, the app is not useful anymore.
    Any help would be highly appreciated!
    Thanks!
     
    Last edited: Nov 2, 2021
  5. albagarcia17

    albagarcia17

    Joined:
    Jul 6, 2023
    Posts:
    2
    Hi @komalsharma21294
    I'm encountering the same problem. Could you share how you successfully addressed it?

    Thanks!