Unityで外部のAndroidアプリを開く
string appName = "com.TikChoco.Yuna"; //ここに開きたいアプリケーションIDを書く
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
using (AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
{
AndroidJavaObject pm = activity.Call<AndroidJavaObject>("getPackageManager");
AndroidJavaObject intent = default;
try
{
intent = pm.Call<AndroidJavaObject>("getLaunchIntentForPackage", appName);
}
catch { Debug.Log("アプリを開けません"); return; }
activity.Call("startActivity", intent);
}
}