Is there any way I can uninstall an app from my device using Flutter?
352
Answer inspired from this question and by @Vicky Salunkhe
To uninstall an app pass the package name to it. $packageName
is a variable ex, some.app.id
android_intent.Intent()
..setAction(android_action.Action.ACTION_DELETE)
..setData(Uri.parse("package:$packageName"))
..startActivityForResult().then((data) {
print(data);
}, onError: (e) {
print(e);
});
add a package in your pubspec.yaml
file
intent: ^1.3.4
permission in manifest
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
Read more answers here and can also refer here
Author by
Tushar Kumar
Updated on December 21, 2022Comments
-
Tushar Kumar over 1 year
I am using device_apps to list the available apps on my device. I want to uninstall an app by tapping on the Icon button, is there any way I can do the same?enter image description here
-
AmitB10 almost 4 yearsYou can't do it inside your app.. Refer here: stackoverflow.com/questions/55163793/…
-