-1

Greeting everyone!! I am creating an android application on it i have to make an option of uninstalling the installed application.

I have listed the installed application using the following code.

Here is my code.

 packageManager = getPackageManager();
 List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
 PACKAGENAME = getApplicationContext().getPackageName();
 new LoadApplications().execute();

But i don't know how to uninstall the apps by presenting my code on OnClickListener.

Please give me some suggestion.

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
arvind AK
  • 31
  • 4

1 Answers1

0
String packageNameOfAppToUninstall = "org.abc.test"; 
Uri packageUri = Uri.parse("package:" + packageNameOfAppToUninstall);
Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
startActivity(uninstallIntent);
Brijesh Chopda
  • 195
  • 2
  • 11