Skip to main content
Participant
April 4, 2023

App Deeplink - Unity

Hello,

This script woks just fine. I have it in another project. I was using it in my current project and it too was working just great, but today, suddenly when I collide with the GameObject that has the script on it instead of launching the app (Real Fishing VR) I am sent to the Meta homeroom. Almost like my app just crashed (the one I'm working on, not the Fishing app). Could I have accidentally made a simple change to anything essential? idk. Seriously I'm dumbfounded. All my settings are the same and of course the Oculus SDK is installed. It was working just fine for the past week. This is a new project and all I really did was create a few UI's, basic menus with dropdown's. Idk, I'm not sure that more information is necessary here. It's a simple room, a few assets, 1 grabbable item with a respawn script. A basic UI with Play/Pause/Stop buttons for audio, and a Scene selector (script) on a menu. Again I'm dumb founded as it was working just fine and I made no changes to any project settings. Idk, maybe it's not enough to go on but heres the script. 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Oculus.Platform;
 
public class DeepLink : MonoBehaviour
{
    // The ID of the app to launch
    public string APP_ID = "2582932495064035";
 
    private bool collided = false;
 
    private void OnTriggerEnter(Collider other)
    {
        if (!collided)
        {
            // Set the deeplink message option
            ApplicationOptions options = new ApplicationOptions();
            options.SetDeeplinkMessage("abc");
 
            // Convert the APP_ID to ulong and launch the other app
            ulong appId = ulong.Parse(APP_ID);
            Oculus.Platform.Application.LaunchOtherApp(appId, options);
 
            collided = true;
        }
    }
}

8 replies

Participant
April 4, 2023

--

sikaar
New Participant
April 9, 2023

I was investigating the very same use case, and i am also stuck at this point. I am trying to use the AndroidJavaObject approach but so far it doesn't work either ... ( https://communityforums.atmeta.com/t5/Quest-Development/Open-Store-Page-from-Unity-app/td-p/1028506 )

Participant
April 9, 2023

This script is working just fine in one project. I have recently added a few more "doors" if you will and the apps launch just fine. If I do not have the app installed the Meta browser pops up so that I can download it from the store. I'm so confused as to why it's not working in ANY of my other projects. I have asked a friend to try this very script in her project and when she collides with the object with said script on it, her app crashes. Same as with my other projects. I'm so confused. One project, working perfectly fine. 

Up and Coming
May 3, 2023

So you are doing app-to-app travel? Did you work with the developer of Real Fishing VR to launch into a destination or are you just opening the app? I'd like to get that working as well, but not many developers seem to be using this API.

Participant
May 5, 2023

Opening the app.

It started working again in this one project as soon as I put in a script to load the Oculus usernames. Don't ask me why but I wont complain. My other projects that never had this issue I am using the Meta Avatar SDK btw. 

sikaar
New Participant
May 15, 2023

Does it mean you have oculus integration in all the projects where it works ? I intended to only use XR interaction toolkit, but if no other choice I will go down that road and add it.

Participant
May 30, 2023

Yes I am using Oculus Integration. Heres what was missing " Core.Initialize();" So you can use this script here. I added this to a button instead of walking into the door you have to click it lol.. either way it turns out ' Core.Initialize();' was the key.. 
(Change the app ID in the inspector)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Oculus.Platform;
 
public class DeepLink : MonoBehaviour
{
    // The ID of the app to launch
    public string APP_ID = "2582932495064035";
 
    public void LaunchOtherAppOnClick()
    {
        // Initialize the Oculus Platform SDK
        Core.Initialize();
 
        // Set the deeplink message option
        ApplicationOptions options = new ApplicationOptions();
        options.SetDeeplinkMessage("abc");
 
        // Convert the APP_ID to ulong and launch the other app
        ulong appId = ulong.Parse(APP_ID);
        Oculus.Platform.Application.LaunchOtherApp(appId, options);
    }
}

 

New Participant
September 20, 2023

you are right   Core.Initialize(); is the key it works for me after I add that line.