4

I need to construct PackageUri in order to uninstall package using action.delete. I obtained PackageInfo object using PackageMananger. Is there any way to construct PackageUri using PackageInfo?

thanks.

SohailAziz
  • 8,034
  • 6
  • 41
  • 43

1 Answers1

3

I got it, lets say we have PackageInfo pinfo

String pkg= "package:"+ pinfo.packageName;
Uri pkg_uri= Uri.parse(pkg);

Now we have package uri, to uninstall

Intent intent = new Intent(Intent.ACTION_DELETE, pkg_uri);
startActivity(intent);
SohailAziz
  • 8,034
  • 6
  • 41
  • 43