java – How to find out if Skype is installed


I start skype with the following code.

  Intent skype_intent = new Intent("android.intent.action.VIEW");
            skype_intent.setClassName("", "");
            skype_intent.setData(Uri.parse("skype: skype_name"));

Everything is fine. But if there is no skype on the phone, then the application crashes. How can I call skype differently so that it doesn't crash the application or check for skype on my phone. If you have run the code, if not, display "You don't have skype"?


I think this code does not need an explanation:

private boolean isAppInstalled(String packageName) {
    PackageManager pm = getPackageManager();
    boolean installed = false;
    try {
       pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
       installed = true;
    } catch (PackageManager.NameNotFoundException e) {
       installed = false;
    return installed; 
Scroll to Top