uninstall App Intent - Android android.content.pm

Android examples for android.content.pm:App

Description

uninstall App Intent

Demo Code

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Main {

  public static boolean uninstallApp(Context context, String packageName) {
    boolean success = false;
    final Uri uri = Uri.fromParts("package", packageName, null);
    final Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, uri);
    try {//  w w w .jav  a  2s  .com
      context.startActivity(uninstallIntent);
      success = true;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return success;
  }

}

Related Tutorials