cancel
Showing results for 
Search instead for 
Did you mean: 

I want to launch the Message app installed on MetaQuest from an app developed with unity

B4neto
Honored Guest
I want to launch a messaging app installed on MetaQuest3 from an app developed with Unity.
 
I couldn't open the app with the following code, so I would like to ask if you have any ideas.
  string packageName = "com.facebook.orca";  
  try
  {
    AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
    AndroidJavaObject packageManager = currentActivity.Call<AndroidJavaObject>("getPackageManager");

    AndroidJavaObject launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", packageName);

            if (launchIntent != null)
            {
                currentActivity.Call("startActivity", launchIntent);
                Debug.Log("Startup successful: " + packageName);
            }
            else
            {
                Debug.LogWarning("App not found : " + packageName);
             }
        }
  catch (System.Exception e)
  {
    Debug.LogError("Startup Errors : " + e.Message);
  }

 

0 REPLIES 0