I am building a launcher app in flutter. But I couldn't add the uninstall feature. Please help me.
Asked
Active
Viewed 6,054 times
9
-
you can't *uninstall* the app. You can only ask the system app named *Package Manager* to start uninstall progress, where the user will have to confirm he wahts to uninstall it. – Vladyslav Matviienko Mar 14 '19 at 13:35
-
1How to do that? Can you help? I did it worked in Native Java but don't know how to do it in dart. – Amon Chowdhury Mar 14 '19 at 14:20
-
Are you able to send intents in dart? If you are able, then you should be OK to just send the correct intent, same as in Java – Vladyslav Matviienko Mar 14 '19 at 15:07
-
I am trying but still not sure about the possibility. – Amon Chowdhury Mar 14 '19 at 18:36
-
I am trying this but I don't know it will work or not https://flutter.dev/docs/development/platform-integration/platform-channels#codec – Amon Chowdhury Mar 14 '19 at 18:40
-
hi @AmonChowdhury did you find any solution? – Vicky Salunkhe Jun 02 '20 at 15:23
-
@VickySalunkhe nope – Amon C Jun 03 '20 at 18:26
-
@AmonChowdhury I have found a way to do it, do give it a try and accept the answer if it works :) – Vicky Salunkhe Jun 04 '20 at 13:45
1 Answers
6
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.

Vicky Salunkhe
- 9,869
- 6
- 42
- 59
-
2
-
1
-
1This package crashes my app after two attempts of uninstall, if you also faced the issue then you can search for uninstall apps in pub.dev and download the package that is updated recently to solve this error, this is intent specific issue. Also the package provided by flutter team named as android_intent doesn't support deletion of package currently. – Prateek Jan 24 '21 at 11:03