Example usage for android.content Intent ACTION_DELETE

List of usage examples for android.content Intent ACTION_DELETE

Introduction

In this page you can find the example usage for android.content Intent ACTION_DELETE.

Prototype

String ACTION_DELETE

To view the source code for android.content Intent ACTION_DELETE.

Click Source Link

Document

Activity Action: Delete the given data from its container.

Usage

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

public static void unInstall(Context context, String packageString) {
    Uri packageURI = Uri.parse("package:" + packageString); //com.demo.CanavaCancel
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    context.startActivity(uninstallIntent);
}

From source file:Main.java

public static void uninstall(Context context, String pkg) {
    if (pkg == null) {
        return;// www .  j  ava 2  s . com
    }
    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 boolean uninstallApk(Context context, String packageName) {
    if (TextUtils.isEmpty(packageName)) {
        return false;
    }/*from ww  w  .ja va2  s . co m*/
    Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + packageName));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);
    return true;
}

From source file:Main.java

public static String unInstallBySys(Context context, String pckName) {
    Intent intent = new Intent();
    Uri uri = Uri.parse("package:" + pckName);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_DELETE);
    intent.setData(uri);//from w w  w.j av  a2s  . c o m
    context.startActivity(intent);
    return null;
}

From source file:Main.java

private static Intent getUninstallAppIntent(final String packageName, final boolean isNewTask) {
    Intent intent = new Intent(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + packageName));
    return isNewTask ? intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) : intent;
}

From source file:Main.java

/**
 * uninstall app via package name//  w  w  w  . j  a v  a2s.  com
 * @param context
 * @param packageName
 */
public static void uninstallApp(Context context, String packageName) {
    Uri packageUri = Uri.parse("package:" + packageName);
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DELETE);
    intent.setData(packageUri);
    context.startActivity(intent);
}

From source file:Main.java

public static void uninstallApk(Context context, String packageName) {
    if (context == null)
        return;/*from  w w w .j  a v a2  s .c o m*/
    if (TextUtils.isEmpty(packageName))
        return;
    Intent intent = new Intent(Intent.ACTION_DELETE);
    Uri packageURI = Uri.parse("package:" + packageName);
    intent.setData(packageURI);
    context.startActivity(intent);
}

From source file:Main.java

/**
 * Propose user to uninstall the given application
 *
 * @param context//from   ww  w.  j  a  v a2 s  .  c  o  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

/**
 * uninstall package normal by system intent
 * /*from w  ww.jav a2  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;
}