https://answers.unity.com/questions/627703/detect-if-app-is-installed-on-android.html
public bool IsAppInstalled(string bundleID){
#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(" ********LaunchOtherApp ");
AndroidJavaObject launchIntent = null;
//if the app is installed, no errors. Else, doesn't get past next line
try{
launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage",bundleID);
//
// ca.Call("startActivity",launchIntent);
}catch(Exception ex){
Debug.Log("exception"+ex.Message);
}
if(launchIntent == null)
return false;
return true;
#else
return false;
#endif
"market://details?q=pname:com.myCompany.myAppName/"
Application.OpenURL ("market://details?id=com.example.android"); misspellings
No comments:
Post a Comment