可以用PackageName 去查詢
至於怎麼拿PackageName 這裡就不多提了 0.0
上CODE:
private static bool IsAndroidInstalledApp(string packageName) { try { AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ca = up.GetStatic("currentActivity"); AndroidJavaObject packageManager = ca.Call ("getPackageManager"); AndroidJavaObject appList = packageManager.Call ("getInstalledPackages", 0); int num = appList.Call ("size"); for (int i = 0; i < num; i++) { AndroidJavaObject appInfo = appList.Call ("get", i); string packageNew = appInfo.Get ("packageName"); if (packageNew.CompareTo(packageName) == 0) { return true; } } return false; } catch (Exception e) { Debug.LogErrorFormat("[OpenUrlHelper][IsInstalledApp] Get Exception , PackageName {0}", packageName); return false; } }
好小氣喔,都不提
回覆刪除