Example usage for android.content.pm PackageManager GET_ACTIVITIES

List of usage examples for android.content.pm PackageManager GET_ACTIVITIES

Introduction

In this page you can find the example usage for android.content.pm PackageManager GET_ACTIVITIES.

Prototype

int GET_ACTIVITIES

To view the source code for android.content.pm PackageManager GET_ACTIVITIES.

Click Source Link

Document

PackageInfo flag: return information about activities in the package in PackageInfo#activities .

Usage

From source file:Main.java

public static boolean isAppInstalled(Context ctx, String uri) {
    PackageManager pm = ctx.getPackageManager();
    boolean installed = false;
    try {//from w  w w.j ava2 s . c  o  m
        pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
        installed = true;
    } catch (PackageManager.NameNotFoundException e) {
        installed = false;
    }
    return installed;
}

From source file:Main.java

public static boolean isSkypeClientInstalled(Context myContext) {
    PackageManager myPackageMgr = myContext.getPackageManager();
    try {// w w w .ja  v  a 2  s  . co m
        myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
    } catch (PackageManager.NameNotFoundException e) {
        return (false);
    }
    return (true);
}

From source file:Main.java

public static boolean isPackageExists(Context context, String targetPackage) {
    try {/*from  w w w.  j  av a  2  s  .c om*/
        context.getPackageManager().getPackageInfo(targetPackage, PackageManager.GET_ACTIVITIES);
    } catch (Exception ex) {
        return false;
    }

    return true;
}

From source file:Main.java

public static boolean appInstalledOrNot(String uri, Context context) {
    PackageManager pm = context.getPackageManager();
    boolean app_installed;
    try {/*from  w w w . j a va2s.  c  o m*/
        pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
        app_installed = true;
    } catch (PackageManager.NameNotFoundException e) {
        app_installed = false;
    }
    return app_installed;
}

From source file:Main.java

public static boolean isAppInstalled(Context context, String pkg) {
    PackageManager pm = context.getPackageManager();
    boolean installed = false;
    try {/*from   w w w . j  av  a 2  s .  c o m*/
        pm.getPackageInfo(pkg, PackageManager.GET_ACTIVITIES);
        installed = true;
    } catch (Exception e) {
        installed = false;
    }
    return installed;
}

From source file:Main.java

public static final String getAppPackageName(Context context) {
    String ret = null;//from   www  .  ja v  a 2s . c om
    try {
        ret = context.getPackageManager().getPackageInfo(context.getPackageName(),
                PackageManager.GET_ACTIVITIES).packageName;
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    return ret;
}

From source file:Main.java

private static boolean isAppInstalled(String uri, Context context) {
    PackageManager pm = context.getPackageManager();
    boolean installed = false;
    try {//  ww  w .j a  va2  s .  c om
        pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
        installed = true;
    } catch (PackageManager.NameNotFoundException e) {
        installed = false;
    }
    return installed;
}

From source file:Main.java

public static boolean isAppInstalled(String uri, Context context) {
    PackageManager pm = context.getPackageManager();
    boolean app_installed;

    try {// ww  w.  j a v  a  2 s.  c  om
        pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
        app_installed = true;
    } catch (PackageManager.NameNotFoundException e) {
        app_installed = false;
    }

    return app_installed;
}

From source file:Main.java

public static boolean isAppInstaled(Context context, String uri) {
    PackageManager pm = context.getPackageManager();
    try {//from  www . j  a  v  a  2  s .c  om
        pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);

        return true;
    } catch (PackageManager.NameNotFoundException e) {

        return false;
    }
}

From source file:Main.java

public static boolean isAppInstalled(Context context, String packageName) {
    PackageManager pm = context.getPackageManager();
    boolean installed;
    try {/*from  w w w. ja  va2 s.  c om*/
        pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
        installed = true;
    } catch (PackageManager.NameNotFoundException e) {
        installed = false;
    }
    return installed;
}