Documentation for the Unity C# Library
Loading...
Searching...
No Matches
LoginUtils.cs
Go to the documentation of this file.
1using System;
2using UnityEngine;
3
5{
6 public class LoginUtils
7 {
8 private static string HUB_APP_PACKAGE = "com.PixoVR.PixoHub";
9
10 public static bool CheckHubInstalled()
11 {
12 AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
13 AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity");
14 AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager");
15
16 AndroidJavaObject launchIntent = null;
17 try
18 {
19 launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", HUB_APP_PACKAGE);
20 }
21 catch (Exception ex)
22 {
23 return false;
24 }
25
26 Debug.Log($"HUB_APP: Hub App installed: {launchIntent != null}");
27
28 return launchIntent != null;
29 }
30 }
31}