Android examples for App:Package
uninstall package normal by system intent
import java.io.File; import java.util.List; import com.chuck.commonlib.util.ShellUtils.CommandResult; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; import android.os.Build; import android.provider.Settings; import android.util.Log; public class Main{ /**//from w w w.j av a2 s.c o m * uninstall package normal by system intent * * @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; } }