I am building a launcher app in flutter. But I couldn't add the uninstall feature. Please help me.
Add a permission in manifest
file
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
add a package in your pubspec.yaml
file
intent: ^1.3.4
Use the below shown code and
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);
});
using this a system generated popup will occur asking to uninstall the app.
So using this you can uninstall apps on your android device using flutter programmatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With