On Android setSmallIcon when used with an XML resource adds unneeded padding, makes notification icon look incorrect.
Our notification icon is an XML resource. As you can see the icon is not scaled correctly and seems to have padding. When used with pure FCM push (no Responsys) the icon appears correctly and at the right size. Also it would be nice if you provided a setIconColor function (for default_notification_color) in order to style the icon for when the icon is provided in XML format. When a PNG resource is used, the icon appears correctly in Responsys. So this is an incompatibility with XML icons.
Is there a reason you can't use the default icon settings that are already passed to FCM in AndroidManifest?
The native code is as follows:
// if it's a responsys push, set the icon and handle it with Responsys
if (pushIOManager.isResponsysPush(remoteMessage)) {
String appName = reactContext.getPackageName();
int notificationIconID = reactContext.getResources().getIdentifier("ic_launcher_foreground", "drawable", appName);
pushIOManager.setDefaultSmallIcon(notificationIconID);
pushIOManager.setDefaultLargeIcon(notificationIconID);
pushIOManager.handleMessage(remoteMessage);
} else {
// Otherwise not a Responsys push notification, handle it through FCM only
FCMModule.onMessageReceived(reactContext, dataMap);
}
Responsys:

FCM:

Please share the XML file that has this issue.
The xml you have shared is for launcher icon.
When a launcher icon xml is used as a notification icon, there is a padding added by the system.
Firebase SDK reads the icon xml as a launcher icon, so the padding is not added by the system.
Responsys SDK reads the icon xml as a notification icon, so the padding is added by the system.
There are two ways to resolve this,
- Don't set the small Icon in Responsys SDK. This will force the Responsys SDK to read the icon as a launcher icon. OR
- Create a copy of the launcher icon xml and use it as a notification icon.
-- In Android Studio, go to File > New > Image Asset
-- Select
Icon TypeasNotification IconsandAsset TypeasImage. -- Pick the icon xml file in thePathentry. -- Once the icon xml is loaded, you should be able to see the extra padding added (even thoughPaddingdisplays 0%). -- To remove the padding, selectTrimasYesand save the file.
Just wanted to let you know the following does not work.
Don't set the small Icon in Responsys SDK. This will force the Responsys SDK to read the icon as a launcher icon.
Not setting the icon in Responsys causes a blank white circle icon. Otherwise we wouldn't be setting the icon in Responsys at all. Can you just make Responsys use the FCM / App icon from the AppManifest?
Hello @neerhaj just checking back in. Any plans to allow Responsys to use the app icon like FCM does? If we don't set the icon in Responsys, it shows up as a white dot.
We are looking into the possible ways to allow apps to set the smallIcon. We'll get back with an update shortly.