Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Remote notification, provided icon in payload not used in foreground #1729

Closed
@theasc

Description

@theasc

I am trying to change the notification Icon used according to the payloads in a react-native project on the android side. Here's the payload:

{"GCM": "{\"notification\": { \"text\": \"text\", \"title\": \"Title\", \"icon\":\"ic_stat_logo\", \"color\":\"#FA8072\"}}"}

What I am getting, however, is that when the app is in the background or closed the notification icon displayed is the one I provided, but in the foreground, it displays the app icon instead.

I tried to look at the documentation but nothing has been found after searching for a long time. Is this an android restriction if so any way to bypass it?

Also here's the manifest:

`I am trying to change the notification Icon used according to the payloads in a react-native project on the android side. Here's the payload:

{"GCM": "{"notification": { "text": "text", "title": "Title", "icon":"ic_stat_logo", "color":"#FA8072"}}"}
What I am getting, however, is that when the app is in the background or closed the notification icon displayed is the one I provided, but in the foreground, it displays the app icon instead.

How can I bypass this behaviour ?

Also here's the manifest:

<meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/channel_id" />
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />


<meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
            android:value="@string/channel_name"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description" android:value="@string/channel_description"/>

<!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
<meta-data  android:name="com.dieam.reactnativepushnotification.notification_foreground"
    android:value="true"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

<service
    android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
    android:exported="false" >
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

<activity
    android:name=".MainActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:launchMode="singleTask"
    android:fitsSystemWindows="true"
    android:label="@string/app_name"
    android:windowSoftInputMode="adjustPan"
    android:screenOrientation="portrait">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions