react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Remote push notification icon issues android

Open oogushikun opened this issue 5 years ago • 11 comments

My push notification works with sound, but I can't see the large icon for both background and foreground remote notifications. Screenshot 2020-08-27 at 10 02 36

Also I get this icon when in the foreground. Screenshot 2020-08-27 at 10 05 35.

AndroidManifest.xml <!-- PUSH Notification --> <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification" /> <meta-data android:name="com.dieam.reactnativepushnotification.notification_icon" android:resource="@drawable/ic_notification" /> <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="rn-push-notification-channel-id-4-default-300" tools:replace="android:value" /> <!-- 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 value to false if you don't want the creation of the default channel --> <meta-data android:name="com.dieam.reactnativepushnotification.channel_create_default" 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"/> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" /> <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> <!-- PUSH Notification -->

oogushikun avatar Aug 27 '20 07:08 oogushikun

Fixed the foregroud issue. Any idea how to set largeicons for remote notifications?

oogushikun avatar Aug 27 '20 10:08 oogushikun

Not getting large icons when app is in background state.

TaraSinghDanu avatar Sep 09 '20 13:09 TaraSinghDanu

Fixed the foregroud issue. Any idea how to set largeicons for remote notifications?

how did you solve foreground issue? I am not getting the icon either.

danielfx90 avatar Sep 14 '20 21:09 danielfx90

@hadimoha how'd you fix the foreground issue?

CaptBoscho avatar Sep 18 '20 18:09 CaptBoscho

share what's in your manifest and make sure youre following this https://github.com/zo0r/react-native-push-notification/issues/730#issuecomment-389545259

oogushikun avatar Sep 24 '20 09:09 oogushikun

Im having the same problem, icon is not showing in Android when the app is in background and quit. Any solution?

vgm8 avatar Dec 01 '20 08:12 vgm8

@danielfx90 how did you solve the foreground issue? I'm able to see the icon when the remote notification was received and the app was killed or in the background, but the icon does not show when the app is in the foreground (instead I see a black square). I already verified that my config was similar to what's described in https://github.com/zo0r/react-native-push-notification/issues/730#issuecomment-389545259

flochtililoch avatar Mar 26 '21 21:03 flochtililoch

Im having the same problem, icon is not showing in Android when the app is in background and quit. Any solution?

same here, foreground is ok but background not.

15110011 avatar Jun 18 '21 07:06 15110011

The same experience here as well...please take a look into it... If any solutions available please respond image

Rushabhgedam avatar Aug 26 '21 08:08 Rushabhgedam

I have found the solutions to display the notification icon, if you are using @react-native-firebase/messaging & react-native-push-notification libraries to display the remote notification and local notification, please add the following lines to AndroidManifest.xml file:

<meta-data
            android:name="com.dieam.reactnativepushnotification.notification_color"
            android:resource="@color/ic_notification_color" />
<meta-data
            android:name="com.dieam.reactnativepushnotification.notification_icon"
            android:resource="@drawable/ic_notification" />

<meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_notification" />

<meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/ic_notification_color" />

If you are using local notification then please add the smallIcon field in PushNotificationScheduleObject for example: Screenshot 2021-09-07 at 9 57 20 PM

NOTE: @drawable/ic_notification file must be follow the guidelines provide by Android Developer in link: http://spot.pcc.edu/~mgoodman/developer.android.com/preview/notifications.html Screenshot 2021-09-07 at 9 07 37 PM

You can apply the tint colour of notification icon by adding the field messaging_android_notification_color in firebase.json file like:

{
  "react-native": {
    "crashlytics_debug_enabled": true,
    "messaging_android_notification_color": "@color/ic_notification_color"
  }
}

aareusoftnet avatar Sep 07 '21 16:09 aareusoftnet

I am having the issue when app is killed or phone light is off and you receive notification so in dark mode notification icon is white in that case otherwise its green when app is in foreground If any solution available please respond

anurag55555 avatar Jan 05 '22 06:01 anurag55555