List of usage examples for android.content Intent addFlags
public @NonNull Intent addFlags(@Flags int flags)
From source file:Main.java
public static boolean installApk(Context context, String filePath) { File file = new File(filePath); if (!file.exists() || !file.isFile() || file.length() <= 0) { return false; }/*from w w w . java 2s. c o m*/ Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive"); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); return true; }
From source file:Main.java
public static void getMoreApps(Context context, String publisherName) { Intent intent = new Intent(Intent.ACTION_VIEW, getMoreAppsUri(publisherName)); if (isIntentAvailable(context, intent)) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);/*from w w w.ja va 2 s . c o m*/ } else { Toast.makeText(context, "Network Error", Toast.LENGTH_LONG).show(); } }
From source file:Main.java
/** * uninstall package normal by system intent * // w w w . java2 s. c o m * @param context * @param packageName package name of app * @return whether package name is empty */ public static boolean uninstallNormal(Context context, String packageName) { if (packageName == null || packageName.length() == 0) { return false; } Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse(new StringBuilder(32).append("package:").append(packageName).toString())); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); return true; }
From source file:Main.java
public static Intent getBootSpeedActivityIntent() { Intent intent = new Intent(); intent.setClassName("com.lenovo.safecenter", "com.lenovo.performancecenter.performance.BootSpeedActivity"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }
From source file:Main.java
public static Intent getAndroidAppNotificationOpenManager() { Intent intent = new Intent(); intent.setClassName("com.android.systemui", "com.android.systemui.lenovo.settings.AppNotificationOpenManager"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }
From source file:Main.java
public static Intent getBootStartIntent() { Intent intent = new Intent(); intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.bootstart.BootStartActivity"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }
From source file:Main.java
public static Intent getAddViewMonitorIntent() { Intent intent = new Intent(); intent.setClassName("com.huawei.systemmanager", "com.huawei.systemmanager.addviewmonitor.AddViewMonitorActivity"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }
From source file:Main.java
public static boolean isAppInstalled(Context context, String desiredPackageName) { Intent intent = new Intent("android.intent.action.MAIN"); intent.addCategory("android.intent.category.LAUNCHER"); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, 0); for (ResolveInfo info : resolveInfoList) { if (info.activityInfo.packageName.equalsIgnoreCase(desiredPackageName)) { return true; }/*from ww w .j a va2 s . c o m*/ } return false; }
From source file:Main.java
public static boolean startActivityUsingScheme(Context a, String scheme) { Uri uri = Uri.parse(scheme + "://"); Intent intent = new Intent(Intent.ACTION_RUN, uri); boolean result = true; try {//from w w w .j ava 2 s .co m intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); a.startActivity(intent); } catch (Exception e) { Log.e(a.getClass().getName(), e.getMessage(), e); result = false; } return result; }
From source file:Main.java
public static Intent getNotificationManageIntent() { Intent intent = new Intent(); intent.setClassName("com.huawei.systemmanager", "com.huawei.notificationmanager.ui.NotificationManagmentActivity"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }