Android 및 iOS(버전 > 10.3)에서 동적 앱 아이콘 변경을 가능하게 하는 플러터 플러그인입니다. 사용자가 런타임 중에 다양한 앱 아이콘 간 전환을 할 수 있게 하여 개인화 및 브랜딩의 유연성을 향상시킵니다. 패키지는 플러터 프로젝트와 원활하게 통합되며 주요 두 모바일 플랫폼을 모두 지원합니다. 재설치 없이 프로그래밍 방식으로 앱 아이콘을 업데이트할 수 있습니다. 사용자 선호 또는 이벤트에 따라 테마형 또는 맥락 기반 아이콘을 제공하고자 하는 앱에 이상적입니다.
사용 사례
사용자 선호도에 따라 앱 아이콘 변경
계절 또는 이벤트 주제 아이콘 지원
앱 브랜딩 사용자 지정 활성화
앱 상태에 따라 동적으로 아이콘 업데이트
개인화된 앱 경험
주요 기능
런타임 아이콘 전환
Android 및 iOS > 10.3 지원
간단한 API 통합
앱 재설치 필요 없음
크로스 플랫폼 호환성
적합한 대상
아이콘 맞춤 설정이 필요한 앱
브랜딩 및 마케팅 캠페인
테마 애플리케이션
사용자 중심의 UI 사용자 정의
이벤트 기반 앱 경험
고려 사항
플랫폼별 설정이 필요합니다
iOS 지원은 버전 10.3 이상에 한해 제한됩니다
아이콘 변경을 위해 앱 스토어 승인이 필요할 수 있습니다
사전 정의된 아이콘 세트에 한정
아이콘 재로드 중 성능에 미치는 잠재적 영향
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
flutter_dynamic_icon_plus
A flutter plugin for dynamically changing app icon and app icon batch number (iOS only) in the mobile platform. Supports only iOS (with version > 10.3).
Update android/src/main/AndroidManifest.xml as follows:
<application...><activityandroid:name=".MainActivity"android:launchMode="singleTop"android:theme="@style/LaunchTheme"android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"android:hardwareAccelerated="true"android:windowSoftInputMode="adjustResize"android:enabled="true"><meta-dataandroid:name="io.flutter.embedding.android.NormalTheme"android:resource="@style/NormalTheme"
/><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity><!-- The activity-alias are your alternatives icons and name of your app, the default one must be enabled (and the others disabled) and the name must be ".DEFAULT". All the names of your activity-alias' name must begin with a dot. --><!-- FOR NOW USE "icon_1" AS ALTERNATIVE ICON NAME --><activity-aliasandroid:label="Your app"android:icon="@mipmap/ic_launcher_1"android:roundIcon="@mipmap/ic_launcher_1"android:name=".icon_1"android:exported="true"android:enabled="false"android:targetActivity=".MainActivity"><meta-dataandroid:name="io.flutter.embedding.android.NormalTheme"android:resource="@style/NormalTheme"
/><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity-alias><activity-aliasandroid:label="Your app"android:icon="@mipmap/ic_launcher_2"android:roundIcon="@mipmap/ic_launcher_2"android:name=".icon_2"android:exported="true"android:enabled="false"android:targetActivity=".MainActivity"><meta-dataandroid:name="io.flutter.embedding.android.NormalTheme"android:resource="@style/NormalTheme"
/><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity-alias></application>
Include applicationIdSuffix
If your app contains applicationIdSuffix please add applicationId on your activity-alias name for example
To integrate your plugin into the iOS part of your app, follow these steps
First let us put a few images for app icons, they are
teamfortress@2x.png, teamfortress@3x.png
photos@2x.png, photos@3x.png,
chills@2x.png, chills@3x.png,
These icons shouldn't be kept in Assets.xcassets folder, but outside. When copying to Xcode, you can select 'create folder references' or 'create groups', if not you will get and error when uploading the build to the AppStore saying: (Thanks to @nohli for this observation)
TMS-90032: Invalid Image Path - - No image found at the path referenced under key 'CFBundleAlternateIcons':...
Here is my directory structure:
Next, we need to setup the Info.plist
Add Icon files (iOS 5) to the Information Property List
Add CFBundleAlternateIcons as a dictionary, it is used for alternative icons
Set 3 dictionaries under CFBundleAlternateIcons, they are correspond to teamfortress, photos, and chills
For each dictionary, two properties — UIPrerenderedIcon and CFBundleIconFiles need to be configured
If the sub-property UINewsstandIcon is showing under Icon files (iOS 5) and you don't plan on using it (it is intended for use with Newstand features), erase it or the app will get rejected upon submission on the App Store
Note that if you need it work for iPads, You need to add these icon declarations in CFBundleIcons~ipad as well. See here for more details.
Here is my Info.plist after adding Alternate Icons
To update app icon, set iconName with specific value. To restore default app icon fill with null. Fill blacklistBrands, blacklistManufactures, and/or blacklistModels to use old approach (force restart), this property just work on Android only.
applicationIconBadgeNumber
int
To get app icon badge, number of push notification received. This method just work on iOS only.
This was made possible because this blog. I borrowed a lot of words from this blog.
https://medium.com/ios-os-x-development/dynamically-change-the-app-icon-7d4bece820d2
This plugin inspired from another existing plugin. I copy a lot of code from these plugin.
https://pub.dev/packages/flutter_dynamic_icon