Skip to content

Amplify doesn't display custom icons for Push Notifications #11593

Closed as not planned
@antonymon

Description

@antonymon

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Push Notifications

Amplify Categories

notifications

Environment information

# Put output below this line
npm run android

Describe the bug

I have been trying to add a custom icon for Push Notifications in Amplify, but I'm facing some difficulties. I have attempted to add the icon in the drawable-* and minimap-* folders, and I even used the icons generated from the Android Asset Studio (http://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&name=ic_stat_onesignal_default) to confirm that the issue is not with my icons.

Example: How to Add Default Icons
I followed the guide: https://docs.amplify.aws/lib/push-notifications/getting-started/q/platform/react-native/

In the JSON configuration, I included the following line:

"IconReference": "ic_notification"

However, the custom icon is not being displayed. I also tried passing a URL in ImageIconUrl, but it didn't work either. I have followed various Firebase guides and attempted to include the icon in the AndroidManifest.xml, but the result is always the same: it shows a small Android icon, which I assume is the default one.

Steps to Reproduce:

  • Add custom icon files to drawable-* and minimap-* folders.
  • Update the IconReference property in the JSON configuration.
  • Attempt to display a Push Notification with the custom icon.

Actual Behavior:
The Push Notification always shows a small default Android icon.

Additional Information:

  • I have tried multiple solutions and followed various guides, but none of them have resolved the issue.
  • I have confirmed that the custom icon files are correctly placed in the appropriate folders.
  • I have also tried passing a URL for the icon, but it didn't work either.
  • Please let me know if there's any additional information or steps I can provide to help resolve this issue.

Thank you!

Expected behavior

The Push Notification should display the custom icon specified in the configuration.

Reproduction steps

  • Add custom icon files to drawable-* and minimap-* folders.
  • Update the IconReference property in the JSON configuration.
  • Attempt to display a Push Notification with the custom icon.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js


const awsmobile = {
  aws_project_region: "region",
  aws_cognito_identity_pool_id: "region:xxxxxx",
  aws_cognito_region: "region",
  oauth: {},
  aws_cognito_username_attributes: [],
  aws_cognito_social_providers: [],
  aws_cognito_signup_attributes: [],
  aws_cognito_mfa_types: [],
  aws_cognito_password_protection_settings: {
    passwordPolicyCharacters: [],
  },
  aws_cognito_verification_mechanisms: [],
  aws_mobile_analytics_app_id: "xxxxx",
  aws_mobile_analytics_app_region: "region",
  Analytics: {
    AWSPinpoint: {
      appId: "xxxxx",
      region: "region",
    },
  },
  Notifications: {
    Push: {
      AWSPinpoint: {
        appId: "xxxxx",
        region: "region",
      },
    },
  },
}

export default awsmobile

Manual configuration

No response

Additional configuration

Add for support:

<uses-sdk
    tools:overrideLibrary="com.amplifyframework.pushnotifications.pinpoint.common, com.amplifyframework.annotations, com.amplifyframework.common.core" />

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

The first icon:

Screenshot 2023-07-07 at 13 23 46

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions