-2

Is it possible thereotically to create an Android application that contains delete button within itself that deletes the app when pressed?

delete picture

Nikola
  • 890
  • 1
  • 11
  • 35

2 Answers2

2

yes it is you can use:

Uri pkgUri = Uri.parse("package:com.example");  
Intent deleteIntent = new Intent(Intent.ACTION_DELETE,pkgUri);  
startActivity(deletelIntent);  

hope this will help.

Ahmad Sanie
  • 3,678
  • 2
  • 21
  • 56
2

You can use this for uninstalling the app

 button.setOnClickListener(new View.OnClickListener(){

          public void onClick(View view){

            Uri packageUri = Uri.parse("package:com.exaample.test");

            Intent uninstallIntent =
              new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
            startActivity(uninstallIntent);
          }
        });

I hope this will help you

Sandeep Singh
  • 1,117
  • 2
  • 11
  • 29