Deleting applications by their package name using codes in android
After releasing the application to delete applications by their package name, you may asked how is this done on android. And here is how i did it.
Explanation
We build the proper package name using Uri.fromParts function, this will results in something like package://xxx
Uri uri = Uri.fromParts("package", <Your Package name here>, null);
We then create a new intent that have the delete action with our package uri
Intent deleteIntent = new Intent(Intent.ACTION_DELETE, uri);
Finally we start the deleteIntent that would show us the uninstall application dialog box
startActivity(deleteIntent);
Hope this helps
Update History
Jan 17, 2012 - Visual Update
Uri uri = Uri.fromParts("package", <Your Package name here>, null);
Intent deleteIntent = new Intent(Intent.ACTION_DELETE, uri);
startActivity(deleteIntent);
Explanation
We build the proper package name using Uri.fromParts function, this will results in something like package://xxx
Uri uri = Uri.fromParts("package", <Your Package name here>, null);
We then create a new intent that have the delete action with our package uri
Intent deleteIntent = new Intent(Intent.ACTION_DELETE, uri);
Finally we start the deleteIntent that would show us the uninstall application dialog box
startActivity(deleteIntent);
Hope this helps
Update History
Jan 17, 2012 - Visual Update
No comments: