List of usage examples for android.content Intent FLAG_ACTIVITY_NEW_TASK
int FLAG_ACTIVITY_NEW_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_NEW_TASK.
Click Source Link
From source file:Main.java
public static void goToMiuiPermissionActivity_V6(Context context) { Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR"); intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity"); intent.putExtra("extra_pkgname", context.getPackageName()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isIntentAvailable(intent, context)) { context.startActivity(intent);/* w w w .ja v a2 s . co m*/ } else { Log.e(TAG, "Intent is not available!"); } }
From source file:Main.java
/** * Get the intent used to open installation U.I. * * @param fileUri downloaded file URI from the download manager. * @return intent to open installation U.I. *//*from w w w . ja va 2 s .c om*/ @NonNull static Intent getInstallIntent(Uri fileUri) { Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE); intent.setData(fileUri); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); return intent; }
From source file:Main.java
public static Intent getComponentIntent(String packageName, String className, Bundle bundle) { Intent intent = new Intent(Intent.ACTION_VIEW); if (bundle != null) intent.putExtras(bundle);/*from ww w . j av a2s .c o m*/ ComponentName cn = new ComponentName(packageName, className); intent.setComponent(cn); return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); }
From source file:Main.java
public static void openAppSettings(Context context) { Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + context.getPackageName())); myAppSettings.addCategory(Intent.CATEGORY_DEFAULT); myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(myAppSettings); }
From source file:Main.java
public static void goToMiuiPermissionActivity_V8(Context context) { Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR"); intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity"); // intent.setPackage("com.miui.securitycenter"); intent.putExtra("extra_pkgname", context.getPackageName()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isIntentAvailable(intent, context)) { context.startActivity(intent);//from w w w. j a v a 2 s. c om } else { intent = new Intent("miui.intent.action.APP_PERM_EDITOR"); intent.setPackage("com.miui.securitycenter"); intent.putExtra("extra_pkgname", context.getPackageName()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isIntentAvailable(intent, context)) { context.startActivity(intent); } else { Log.e(TAG, "Intent is not available!"); } } }
From source file:Main.java
/** * uninstall package normal by system intent * /*from w w w . j av a2s . 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
/** * install app//from w w w . jav a2s .c o m * * @param context * @param filePath * @return whether apk exist */ public static boolean install(Context context, String filePath) { Intent i = new Intent(Intent.ACTION_VIEW); File file = new File(filePath); if (file != null && file.length() > 0 && file.exists() && file.isFile()) { i.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive"); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); return true; } return false; }
From source file:Main.java
public static void startActivity(Context mContext, Class className) { Intent intent = new Intent(); intent.setClass(mContext, className); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent);/*from w w w .j a v a2 s . c o m*/ }
From source file:Main.java
public static void feedback(Context context, String feedBackEmailId, String emailSubject, String msg) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { feedBackEmailId }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); emailIntent.putExtra(Intent.EXTRA_TEXT, msg); emailIntent.setType("message/rfc822"); emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (isIntentAvailable(context, emailIntent)) { context.startActivity(emailIntent); } else {//from www . j a va2 s.com Toast.makeText(context, "No Email Application Found", Toast.LENGTH_LONG).show(); } }
From source file:Main.java
public static boolean installApp(Context context, String filePath) { if (filePath != null && filePath.length() > 4 && filePath.toLowerCase().substring(filePath.length() - 4).equals(".apk")) { Intent intent = new Intent(Intent.ACTION_VIEW); File file = new File(filePath); if (file.exists() && file.isFile() && file.length() > 0) { intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); return true; }/* ww w.java 2s. c om*/ } return false; }