Why LargeIcon not display on android in background and closed app state?
I am not getting large icon if receiving notification in background or closed app state.

Here Top notification I am getting when app in foreground and second one when app is background. Please suggest how to show large icon in background and closed app state too.
This is a configuration I have inside project::
PushNotification.configure({
// (required) Called when a remote or local notification is opened or received
onNotification: this.clickOnOpenAppNotification,
// IOS ONLY (optional): default: all - Permissions to register.
permissions: { alert: true, badge: true, sound: true },
// Should the initial notification be popped automatically
// default: true
popInitialNotification: true,
/**
* (optional) default: true
* - Specified if permissions (ios) and token (android and ios) will requested or not,
* - if not, you must call PushNotificationsHandler.requestPermissions() later
* - if you are not using remote notification or do not have Firebase installed, use this:
* requestPermissions: Platform.OS === 'ios'
*/
requestPermissions: true,
largeIcon: 'ic_launcher',
smallIcon: '@mipmap/notification_state',
});
Hi @ArchanaSharma95
PushNotification.configure doesn't accept largeIcon or smallIcon, please recheck the Readme.
Regards
@Dallas62 , thanks, can you suggest me how can I set these icons, as I am using onNotification trigger and it is automatically display my notification. Please suggest how can I set these icons.
https://github.com/zo0r/react-native-push-notification#local-notifications
@Dallas62 , I have used this inside onNotification handler function like this::
clickOnOpenAppNotification(notification) {
console.log("noti", notification)
PushNotification.localNotification({
title: notification && notification.notification && notification.notification.title || '',
message: notification && notification.notification && notification.notification.body || '',
userInfo: notification.data,
playSound: true,
soundName: 'default',
largeIcon: "ic_launcher",
smallIcon: "@mipmap/notification_state",
});
}
Still I am having same issue.
https://github.com/zo0r/react-native-push-notification/issues/1728#issuecomment-719434987
@Dallas62 I have checked my manifest file everything is set correctly. Also icons are added inside res folder.
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground" android:value="false"/>
<!-- 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"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/notification_state" />
And now inside onMessage handler I am setting local notification like this. When I am getting remote notification then this returns a notification value and here I have added localNotification config like this:
this.notificationListener = messaging().onMessage(notification => {
console.log("onMessage", notification)
if (notification) {
if (isIOS) {
PushNotification.localNotification({
title: notification && notification.notification && notification.notification.title || '',
message: notification && notification.notification && notification.notification.body || '',
userInfo: notification.data,
});
}
else {
PushNotification.localNotification({
channelId: "my-channel",
title: notification && notification.notification && notification.notification.title || '',
message: notification && notification.notification && notification.notification.body || '',
userInfo: notification.data,
showWhen: true,
// when: null,
playSound: true,
soundName: 'default',
largeIcon: "@mipmap/ic_launcher",
smallIcon: "@mipmap/notification_state",
});
}
}
});
I am still not able to show large icon in background and closed app state. Please help I have already invested a day to add this icon.
@ArchanaSharma95 you should set name of icon = ic_notification
Hi, did you get your notification issue resolved?
Hi @ArchanaSharma95 did you find a work around for this?