private static bool LaunchAndriodApp(string bundleId, string param = "arguments")
    {
        bool fail = false;

        // get the current activity
        AndroidJavaClass  up           = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject ca           = up.GetStatic <AndroidJavaObject>("currentActivity");
        AndroidJavaObject pm           = ca.Call <AndroidJavaObject>("getPackageManager");
        AndroidJavaObject launchIntent = null;

        try
        {
            launchIntent = pm.Call <AndroidJavaObject>("getLaunchIntentForPackage", bundleId);
            if (launchIntent == null)
            {
                fail = true;
            }
            else
            {
                launchIntent.Call <AndroidJavaObject>("putExtra", param, defaultMessage);
            }
        }
        catch (System.Exception e)
        {
            fail = true;
            SGDebug.Exception(e);
        }

        //open the app
        if (!fail)
        {
            ca.Call("startActivity", launchIntent);
        }

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

        return(!fail);
    }
    public bool CheckAppInstallation(string bundleId)
    {
        bool              installed = false;
        AndroidJavaClass  up        = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject ca        = up.GetStatic <AndroidJavaObject>("currentActivity");
        AndroidJavaObject pm        = ca.Call <AndroidJavaObject>("getPackageManager");

        AndroidJavaObject launchIntent = null;

        try
        {
            launchIntent = pm.Call <AndroidJavaObject>("getLaunchIntentForPackage", bundleId);
            if (launchIntent == null)
            {
                installed = false;
            }

            else
            {
                installed = true;
            }
        }

        catch (System.Exception e)
        {
            SGDebug.Exception(e);
            installed = false;
        }

        // dispose
        up.Dispose();
        ca.Dispose();
        pm.Dispose();
        launchIntent.Dispose();

        return(installed);
    }