通知计数器的显示不超过9。它显示10,并立即重置为9。它不依赖于通知的其他数量。 创建硝化时的代码:
sendNotificationImmediately = (message) => {
if (Platform.OS === 'android') {
PushNotification.localNotification({
title: 'Оператор прислал сообщение',
message: message,
});
} else {
PushNotification.presentLocalNotification({
alertBody: message,
applicationIconBadgeNumber: this.state.counter
});
}
};
删除通知时的代码:
if (Platform.OS === 'android')
PushNotification.cancelAllLocalNotifications()