List of usage examples for android.content.pm PackageManager getLaunchIntentForPackage
public abstract @Nullable Intent getLaunchIntentForPackage(@NonNull String packageName);
From source file:Main.java
public static Intent getLaucher(String otherPackage, Context context) { PackageManager packageManager = (PackageManager) context.getPackageManager(); return packageManager.getLaunchIntentForPackage(otherPackage); }
From source file:Main.java
public static boolean isUpdatedVersion(Context context) { final PackageManager packageManager = context.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage("pay.with.slydepay"); if (intent == null) { return false; }//from ww w . j a v a 2 s . c o m List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; }
From source file:Main.java
public static boolean isSlydepayPresent(Context context) { final PackageManager packageManager = context.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage("com.dreamoval.slydepay.android.cruise"); if (intent == null) { return false; }//from w ww . j a v a 2s. c om List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; }
From source file:Main.java
/** * <pre>// w w w . j a va 2s . c o m * Start other app by its package name. * </pre> * @param packageName app 's package name */ public static void openApp(String packageName) { Context context = getCurrentContext(); PackageManager manager = context.getPackageManager(); Intent intent = manager.getLaunchIntentForPackage(packageName); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addCategory(Intent.CATEGORY_LAUNCHER); context.startActivity(intent); }
From source file:Main.java
public static void openAPK(Context context, String pkgName) { PackageManager packageManager = context.getPackageManager(); Intent intent = new Intent(); intent = packageManager.getLaunchIntentForPackage(pkgName); context.startActivity(intent);/*from w w w . j a va2 s . c o m*/ }
From source file:Main.java
/** * Returns an intent to start K-9 Mail./*from w ww.j av a 2s . c o m*/ * * @param context * Used to retrieve the package manager. * * @return An intent to start K-9 Mail's main activity, or {@code null} in case of an error. */ public static final Intent getStartK9Intent(Context context) { try { PackageManager manager = context.getPackageManager(); Intent intent = manager.getLaunchIntentForPackage(PACKAGE_NAME); intent.addCategory(Intent.CATEGORY_LAUNCHER); return intent; } catch (Exception e) { return null; } }
From source file:Main.java
public static void startActivity(Context context, String packagename) { try {/* w w w.j a v a 2s.co m*/ PackageManager packageManager = context.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage(packagename); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Launches an app with the specified package name if it exists * * @param context//from ww w. j ava 2s .co m * @param packageName The package name of the app to launch * @return <b>true</b> if the app exists and successfully launched, <b>false</b> otherwise */ public static boolean launchApp(Context context, String packageName) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = packageManager.getLaunchIntentForPackage(packageName); if (intent != null) { context.startActivity(intent); return true; } else { return false; } }
From source file:Main.java
public static void openApp(Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); Intent intent = new Intent(); try {//from ww w . ja v a2s.c om intent = packageManager.getLaunchIntentForPackage(packageName); } catch (Exception e) { e.printStackTrace(); } context.startActivity(intent); }
From source file:fi.danielsan.donkino.ui.Navigator.java
private static boolean isAppInstalled(PackageManager packageManager, String packageName) { Intent mIntent = packageManager.getLaunchIntentForPackage(packageName); return mIntent != null; }