uninstall app via package name - Android App

Android examples for App:APK Install and Uninstall

Description

uninstall app via package name

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.Intent;

import android.net.Uri;

public class Main {
    /**/*from   w  w w  . j  av  a 2  s .  c om*/
     * uninstall app via package name
     * @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);
    }
}

Related Tutorials