/// <summary>
        /// Checks if application is available on mobile device
        /// </summary>
        /// <param name="applicationBundleID">Application BundleID (in platforms application store)</param>
        public static bool IsApplicationInstalled(string applicationBundleID)
        {
            //#if UNITY_EDITOR
            //            return false;
            //#elif UNITY_ANDROID
#if UNITY_ANDROID
            AndroidJavaClass  up             = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject ca             = up.GetStatic <AndroidJavaObject>("currentActivity");
            AndroidJavaObject packageManager = ca.Call <AndroidJavaObject>("getPackageManager");
            Debug.Log("Checking for app availability on system.");
            AndroidJavaObject launchIntent = null;
            //if the app is installed, no errors. Else, doesn't get past next line
            try
            {
                launchIntent = packageManager.Call <AndroidJavaObject>("getLaunchIntentForPackage", applicationBundleID);
            }
            catch (Exception ex)
            {
                Debug.Log(string.Format("Error checking app availability: {0}", ex.Message));
            }

            bool result = (launchIntent != null);

            up.Dispose();
            ca.Dispose();
            packageManager.Dispose();
            launchIntent.Dispose();

            Debug.Log(string.Format("Application {0} found: {0}", applicationBundleID, result));
            return(result);
#elif UNITY_IOS
            bool result = false;
            if (ApplicationSchemesMap.ContainsKey(applicationBundleID))
            {
                Debug.Log(string.Format("Direct app request iOS: {0}", iOSApplicationAvailable(ApplicationSchemesMap[applicationBundleID])));
                result = iOSApplicationAvailable(ApplicationSchemesMap[applicationBundleID]);
            }
            else
            {
                result = false;
            }

            Debug.Log(string.Format("Application {0} found: {0}", applicationBundleID, result));
            return(result);
#else
            return(false);
#endif
        }
        /// <summary>
        /// Open application on mobile device, if available
        /// </summary>
        /// <param name="applicationBundleID">Application BundleID (in platforms application store)</param>
        public static void OpenApplication(string applicationBundleID)
        {
            if (IsApplicationInstalled(applicationBundleID))
            {
#if UNITY_ANDROID
                AndroidJavaClass  up             = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject ca             = up.GetStatic <AndroidJavaObject>("currentActivity");
                AndroidJavaObject packageManager = ca.Call <AndroidJavaObject>("getPackageManager");
                Debug.Log("Checking for app availability on system.");
                AndroidJavaObject launchIntent = null;
                //if the app is installed, no errors. Else, doesn't get past next line
                try
                {
                    launchIntent = packageManager.Call <AndroidJavaObject>("getLaunchIntentForPackage", applicationBundleID);
                    ca.Call("startActivity", launchIntent);
                }
                catch (Exception ex)
                {
                    Debug.Log(string.Format("Error checking app availability: {0}", ex.Message));
                }

                up.Dispose();
                ca.Dispose();
                packageManager.Dispose();
                launchIntent.Dispose();
#elif UNITY_IOS
                if (ApplicationSchemesMap.ContainsKey(applicationBundleID))
                {
                    Application.OpenURL(string.Format("{0}://", ApplicationSchemesMap[applicationBundleID]));
                }
                else
                {
                    Debug.Log(string.Format("Error trying to open unavailable application: {0}", applicationBundleID));
                }
#endif
            }
            else
            {
                Debug.Log(string.Format("Error trying to open unavailable application: {0}", applicationBundleID));
            }
        }