Tried both, the cancelLocalNotifications({ id }) with a notification object as:
PushNotification.localNotificationSchedule({
id,
title,
message,
date: moment().toDate(),
largeIcon: 'app_icon',
smallIcon: 'app_icon',
color: 'blue',
userInfo: {
id
}
})
Also, tried cancelAllLocalNotifications() without success.
I can confirm that it is working for Android but not for iOS.
This is the version that worked for me on Android + iOS (with cancel...):
PushNotification.localNotificationSchedule({
id: ''+recordID, // must be id of type STRING so that the cancel will work on android
userInfo: {
id: ''+recordID, //IMPORTANT!! adding the userInfo, so that the cancel will work!
},
number:0, // must have this otherwise it fails.
data: {
recordID: recordID,
},
message: message,
date: someDate,
});
later on:
PushNotification.cancelLocalNotifications({id: ''+recordID}); // must be id of type STRING so that the
cancel will work on android
@EyalSi Confirmed working on Android. Will update after testing on iOS
Thank @EyalSi <3 Important thing is the **id** for cancel must be **String**. Then I solved this issue
PushNotification.cancelLocalNotifications({id: ''+recordID});
Works on iOS.
it is not working foe me. my functions are like this:-
const localNotification = (fromUserName, data, orderId) => {
PushNotification.localNotification({
id: ''+orderId,
autoCancel: true,
largeIcon: JointDeliveryLogoIcon,
smallIcon: JointDeliveryLogoIcon,
bigText: You got a message for (OrderId:-${orderId}),
subText: "",
number:0,
vibrate: true,
vibration: 300,
userInfo: {
id: ''+orderId,
},
color: "green",
title: ${fromUserName},
message: Message:- ${data},
playSound: true,
soundName: 'default',
});
};
const cancelLocalNotifications = (notificationId) => {
console.warn('notification id gettinggggggg=====', notificationId)
PushNotification.cancelLocalNotifications({
id: ''+notificationId
});
anybody please help me
Refer to this: https://stackoverflow.com/a/53909899/8886649
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
Most helpful comment
This is the version that worked for me on Android + iOS (with cancel...):
later on:
cancel will work on android