Kumar Kumar - 1 year ago 154
Android Question

Uninstall android application with out user interaction

I am developing android system application. Directly Uninstall another application without user interaction.
I have wrote peace of code ,

private void UninsallApp() {
Uri packageURI = Uri.parse("package:"+"com.example.shortcutcreation");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);
}


but before uninstall app dialog box is coming like
enter image description here

Could you please help me...

Answer Source

I got solution for this question. I have cracked code AOSP framework level(android.content.pm) and signed as a ploatform apk ... Finally app is silently uninstalling...

or

String cmd = "sh /system/bin/pm uninstall " + packageName;

    try {Process su = Runtime.getRuntime().exec("su");
        DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());
        outputStream.writeBytes(cmd+"\n");
        outputStream.flush();
        outputStream.writeBytes("exit\n");
        outputStream.flush();
        su.waitFor();

    } catch (IOException e) {

        throw new RuntimeException(e);

    } catch (InterruptedException e) {

        throw new RuntimeException(e);
    }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download