Quantcast
Channel: Questions in topic: "exception"
Viewing all articles
Browse latest Browse all 470

How to check if Android app installed on the phone

$
0
0
I want to check if the Android app is installed on the phone, if not - open the Google Play. I tried this code: `AndroidJavaClass up = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); AndroidJavaObject ca = up.GetStatic ("currentActivity"); AndroidJavaObject packageManager = ca.Call ("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 ("getLaunchIntentForPackage", "com.blah.blah"); ca.Call ("startActivity", launchIntent); } catch (UnityException e) { Debug.Log ("exception" + e.Message); Application.OpenURL ("market://details?q=pname:com.blah.blah"); }` But it isn't working, because there must be Exception, and not Unity Exception. Can anyone help me?

Viewing all articles
Browse latest Browse all 470


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>