hi friends
i need some help
when i open unity app in ios device at that time i want to check if the bundle id “com.xyz.abc” is already installed in my device or not, how can i check that for ios app
thanks in advance
hi friends
i need some help
when i open unity app in ios device at that time i want to check if the bundle id “com.xyz.abc” is already installed in my device or not, how can i check that for ios app
thanks in advance
Hi,
For future reference. On Android you can run this code directly from c#
Usage:
if(checkPackageAppIsPresent("com.facebook.katana"))
{
//your code if facebook was found
}
Method:
private bool checkPackageAppIsPresent(string package)
{
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager");
//take the list of all packages on the device
AndroidJavaObject appList = packageManager.Call<AndroidJavaObject>("getInstalledPackages", 0);
int num = appList.Call<int>("size");
for (int i = 0; i < num; i++)
{
AndroidJavaObject appInfo = appList.Call<AndroidJavaObject>("get", i);
string packageNew = appInfo.Get<string>("packageName");
if (packageNew.CompareTo(package) == 0)
{
return true;
}
}
return false;
}
There is no direct way to do it for Ios or Android. You have to write native function . It is explained here better.
IOS
http://forum.unity3d.com/threads/check-if-other-app-is-installed-on-device.272548/
Etcectra Plugin has a method applicationCanOpenUrl which you can use .