oracle / oracle/pushiomanager-react-native

On Android setSmallIcon when used with an XML resource adds unneeded padding, makes notification icon look incorrect.

Open
#21 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
19
Forks
19
PR merge metrics
No merged PRs in 30d

Description

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:
Screen Shot 2021-07-21 at 3 19 10 PM
Screen Shot 2021-07-21 at 3 19 18 PM

FCM:
Screen Shot 2021-07-21 at 3 21 53 PM
Screen Shot 2021-07-21 at 3 21 45 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the native Java code shown in the issue, especially the Responsys branch using setDefaultSmallIcon and setDefaultLargeIcon, and compare it with the FCM path. Reproduce the notification with an XML resource and a PNG resource, then verify the icon sizing and color behavior against the reported screenshots. Done means XML icons render without unwanted padding and the requested default icon color behavior is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.