Приложение использует Unity 3D с C#
Операции в Photon Fusion 2
Выполняется через APK на гарнитуре VR
Код: Выделить всё
public void LaunchApp(string packageName)
{
RPC_LaunchApp(packageName);
}
[Rpc (RpcSources.All, RpcTargets.StateAuthority)]
public void RPC_LaunchApp(string packageName)
{
Debug.Log("We are in the Launch App Method");
bool fail = false;
string bundleId = (string.IsNullOrEmpty(packageName) || packageName.ToUpper() == "TEST" ? Application.identifier : packageName).Trim();
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic("currentActivity");
AndroidJavaObject packageManager = ca.Call("getPackageManager");
AndroidJavaObject launchIntent = null;
try
{
launchIntent = packageManager.Call("getLaunchIntentForPackage", bundleId);
}
catch (System.Exception e)
{
Debug.Log(e);
fail = true;
}
if (fail)
{
//open app in store
Application.OpenURL("https://google.com");
}
else
{
//open the app
ca.Call("startActivity", launchIntent);
}
up.Dispose();
ca.Dispose();
packageManager.Dispose();
launchIntent.Dispose();
}
Подробнее здесь: https://stackoverflow.com/questions/779 ... n-fusion-2