List of usage examples for android.net Uri fromParts
public static Uri fromParts(String scheme, String ssp, String fragment)
From source file:Main.java
public static void unInstallPackage(Context context, String packageName) { Uri packageUri = Uri.fromParts("package", packageName, null); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri); uninstallIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(uninstallIntent); }
From source file:Main.java
private static void uninstallManually(Context context, String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package", packageName, null)); context.startActivity(intent);/* www .j a va 2s . co m*/ }
From source file:Main.java
public static void uninstall(Context context, String pkg) { if (pkg == null) { return;// w ww . jav a2 s .c om } Uri uri = Uri.fromParts("package", pkg, null); Intent intent = new Intent(Intent.ACTION_DELETE, uri); context.startActivity(intent); }
From source file:Main.java
public static void openApplicationSettings(Activity activity) { Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", activity.getPackageName(), null); intent.setData(uri);/* ww w. j ava 2s. c o m*/ activity.startActivity(intent); }
From source file:Main.java
public static void openMyAppInfo(Context mContext) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts(SCHEME, mContext.getPackageName(), null); intent.setData(uri);/* ww w .ja v a2 s. c o m*/ mContext.startActivity(intent); }
From source file:Main.java
public static void openAppDetailSetting(Context context, String packageName) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromParts("package", packageName, null); intent.setData(uri);/*from ww w . j a v a2s . co m*/ context.startActivity(intent); }
From source file:Main.java
public static void jumpToApplicationDetail(Context context) { Intent localIntent = new Intent(); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); localIntent.setData(Uri.fromParts("package", context.getPackageName(), null)); context.startActivity(localIntent);/*ww w . j a va2s . co m*/ }
From source file:Main.java
/** * Propose user to uninstall the given application * * @param context/*from w w w .ja v a 2s .co m*/ * @param packageName package of the application to uninstall */ public static void uinstallApplication(final Context context, final String packageName) { final Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package", packageName, null)); context.startActivity(intent); }
From source file:Main.java
public static void goToInstalledAppDetails(Context context, String packageName) { Intent intent = new Intent(); int sdkVersion = Build.VERSION.SDK_INT; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts("package", packageName, null)); } else {/*ww w. jav a2s . c om*/ intent.setAction(Intent.ACTION_VIEW); intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); intent.putExtra( (sdkVersion == Build.VERSION_CODES.FROYO ? "pkg" : "com.android.settings.ApplicationPkgName"), packageName); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
/** * Send an email via available mail activity * /*w w w. j a va 2 s . c o m*/ * @param context the app context * @param to the email address send to * @param subject the email subject * @param body the email body */ public static void sendEmail(Context context, String to, String subject, String body) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", to, null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, body); context.startActivity(Intent.createChooser(emailIntent, null)); }