I want to change my app's icon from inside app in Android and iOS. How can I achieve this to my app
Asked
Active
Viewed 243 times
-2
-
1I found this only package flutter_dynamic_icon on pub.dev to achieve this feature. – Ujjawal Maurya Feb 17 '22 at 12:11
-
Did you try this? https://stackoverflow.com/questions/1103027/how-to-change-an-application-icon-programmatically-in-android – Dan Baruch Feb 17 '22 at 12:14
-
any other ways to do in Android and iOS both – Ujjawal Maurya Feb 17 '22 at 12:29
3 Answers
0
Its imposible to change app icons inside app. To change the application icon you need to configure it inside the android folder (manifest, drawable...) and in the ios folder. So when the application is built, it is stored and the icon is selected. It is not possible to change it without doing a new build.
Maikzen
- 1,248
- 1
- 5
- 18
-
1You *can* change the app icon during the runtime between a set of different icons which you specify during the build. – luk2302 Feb 17 '22 at 12:07
-
How Google Calender do the same every day. Calender app changes its icon dynamically and shows current date in its icon. – Ujjawal Maurya Feb 17 '22 at 12:08
-
-
@Maikzen I don't think that's correct, you can specify different icon for example for a different language of the device (i.e 1 icon for english 1 icon for w.e) – Dan Baruch Feb 17 '22 at 12:11
0
you can use this package I hope it can help you
flutter_dynamic_icon: ^2.0.0
Mohamed Khaled Selim
- 176
- 1
- 5
0
This flutter_dynamic_icon package can help. For me it worked on iOS
just add it flutter_dynamic_icon: ^2.0.0 to your project and do some changes accordingly
iOS configurations(I found only iOS): (If anyone found Android Configs please share with us)
Add icon images (here.png)
Add some lines in info.plist (>> Raw info.plist <<)
Dart code sample:
import 'package:flutter_dynamic_icon/flutter_dynamic_icon.dart';
try {
if (await FlutterDynamicIcon.supportsAlternateIcons) {
await FlutterDynamicIcon.setAlternateIconName("photos");
print("App icon change successful");
return;
}
} on PlatformException {} catch (e) {}
print("Failed to change app icon");
...
// set batch number
try {
await FlutterDynamicIcon.setApplicationIconBadgeNumber(9399);
} on PlatformException {} catch (e) {}
// gets currently set batch number
int batchNumber = FlutterDynamicIcon.getApplicationIconBadgeNumber();
Check this repo out for detailed explanation
flutter dynamic icon
Ujjawal Maurya
- 159
- 14
-
-
On which platform you are trying to achieve this. This only works on iOS as of now, Android support is yet to come – Ujjawal Maurya Apr 09 '22 at 06:23
-
-
-
it always hits this - print("Failed to change app icon"); it's never successful in my simulator. – Luke Irvin Apr 11 '22 at 15:43