title: How to uninstall apps in android programmatically with PackageInstaller
body: <p>I have created a simple android uninstaller app that helps to remove multiple apps at once. I use this code to accomplish this task:</p>
  
  <pre><code>Uri uri = Uri.fromParts("package", app.getPackageName(), null);
  Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, uri);
  // store result
  intent.putExtra(Intent.EXTRA_RETURN_RESULT, true);
  startActivityForResult(intent, 1);
  </code></pre>
  
  <p>But now, according to this <a href="https://developer.android.com/reference/android/content/Intent#ACTION_UNINSTALL_PACKAGE" rel="nofollow noreferrer">android doc</a>, <code>ACTION_UNINSTALL_PACKAGE</code> is deprecated in API level 29 and it's recommended to use <code>PackageInstaller.uninstall(String, IntentSender)</code> instead. I want to use this new api but I can't find any good example on how this is implemented.
  Any help is appreciated thanks.</p>