在反应原生推送通知中无法从通知栏中删除通知(Android)

问题描述 投票:0回答:1

我正在创建一个剩余的应用程序,其中我无法从通知区域中删除通知,我已经尝试了许多方法来解决这个问题,但仍然没有任何帮助。PushNotification.clearLocalNotification(parseInt(notification.id, 10)); 也试过类似的解决方案,如 PushNotification.cancelLocalNotifications({ id: `${parseInt(notification.id, 10)}` });.但还是无济于事。我试着记录了一下节点包,可以看到记录里面有清除通知的java函数cancel函数,还是没有从通知区中驳回来

编辑:我想在动作(按钮)按下时解除通知。

android react-native push-notification react-native-android react-native-push-notification
1个回答
0
投票

使用 autoCancel: true 要取消通知,请点击

export const LocalNotification = () => {
  PushNotification.localNotification({
    autoCancel: true,
    bigText:
      'This is local notification demo in React Native app. Only shown, when expanded.',
    subText: 'Local Notification Demo',
    title: 'Local Notification Title',
    message: 'Expand me to see more',
    vibrate: true,
    vibration: 300,
    playSound: true,
    soundName: 'default',
    actions: '["Yes", "No"]'
  })
}
© www.soinside.com 2019 - 2024. All rights reserved.