-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot add badge on Android 8 and 9 #77
Comments
+1 |
2 similar comments
+1 |
+1 |
Can you please provide a bit more info to this issue. |
@HazAT They're Android vector drawable resources - the files are XML files. Here's the Android documentation that explains about Adaptive Icons on Android 8: https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive Here's an example of a vector resource:
Which was taken from this page: https://developer.android.com/guide/topics/graphics/vector-drawable-resources Android doesn't support displaying SVG files out of the box, so when we want to use vector assets we import an SVG and it gets converted into the format above |
I have the same issue. I'm trying to support Adaptive icons on Android. In adaptive icons, there are different launcher icons are generated. so, I am trying to add badge and shield to all of them like below code snippet : badge(glob: "/app/src/main/res/mipmap-*/ic_launcher.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true
)
badge(glob: "/app/src/main/res/mipmap-*/ic_launcher_foreground.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true
)
badge(glob: "/app/src/main/res/mipmap-*/ic_launcher_round.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true
) Badge is looking okay but shield ( I am using shield for build number ) does not seem on adaptive icons. I need to add something like shield_geometry "+0+25%" but it does not work. as per documentation : https://github.com/HazAT/badge#--6 When I use shield_geometry on fastlane like this : badge(glob: "/app/src/main/res/mipmap-*/ic_launcher_round.png",
shield: "105", # versionCode of android app
shield_gravity: "NorthWest",
shield_no_resize: true,
shield_geometry: "+0+25%"
) it procudes this error :
|
+1 |
It doesn't work for me even if I badge for |
Here is my configuration. Hoping it would help anyone out: badge(
shield: "BETA-0.0.1-orange",
no_badge: true,
dark: true,
shield_scale: "0.55",
shield_gravity: "Center",
shield_geometry: "+0+30%",
glob: "/app/src/main/res/mipmap-*/ic_launcher*.png",
) OutputOn Android 9 phone |
I'd love to see this fixed. Does anyone have ideas on what needs to be done? |
I suspect the problem with later Android versions is that the plugin doesn't support badging of adaptive icons. Either that would need to be done or, as a workaround, you could remove the adaptive icon files in your badged builds and later versions of Android would then fall back to using the legacy launcher icon instead (which is badged) |
This is what I finally did after reading conflicting reports of badging partially working on adaptive icons. I suspect all of those reports were from people testing pre-8 devices or did not have adaptive icons setup properly. I ended, copying the mipmaps to the res/ directory for our staging flavor, and only using the adaptive icon format for production. |
@hyei thanks, I'll take a look at that |
@osamaq wonderful!. The |
I can see the icons updating with shield values config and version at locations src/main/res & src/debug/res, After build and installed the app, I can see the shield values on app icon for android 7 and doesn't see them in Android (>= 8). May I know is there any update on this. plugin version used: fastlane-plugin-badge 1.4.0 |
As workaround for adaptive icons i'm using only |
I could not get the default badge reasonably positioned for both IOS and Android adaptive and Android legacy icons. So i created a new set of badges. For anyone who is interested https://github.com/bobsmits/gem-badge-adaptive-icon-set/tree/main |
Using this glob configuration, all mipmap launchers in the .png format were badged correctly. I then moved all adaptive launcher icons (*.xml) to the prod source set, which resulted in Android falling back onto the badged icons for non-prod builds. Unfortunately, that way, Samsung (and probably other) phones will squeeze the icon into their adaptive form. The badge is still readable, but it is not beautiful. However, it may still be useful to some of you as a workaround. |
Hi,
Badge does not seems to be added on versions 8 and 9 for Android which uses vector icons as ic_launcher_foreground and ic_launcher_background.
Should this be a future enhancement?
Best regards,
H
The text was updated successfully, but these errors were encountered: