You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Notifee安卓端通知无限循环触发问题咨询

Notifee 安卓周重复通知无限触发异常

使用版本为 "@notifee/react-native": "^4.1.0" 的Notifee库开发安卓端重复通知功能时,出现稳定复现的异常:部分安卓设备上同一条通知会被反复触发,形成无法终止的无限循环,仅能通过系统应用设置页强制停止应用才能关闭通知循环。

已复现场景

  • 用户连续数日未打开应用,之后再次启动应用时触发循环(注:项目内通知调度逻辑仅绑定在按钮点击事件中,未在任何应用生命周期钩子中配置通知调度相关逻辑)
  • 通知预设的触发时间点,用户设备正处于飞行模式,后续恢复网络/退出飞行模式后触发循环

核心实现代码

通知创建调用入口:

notifee.createTriggerNotification(notification, trigger);

触发器(trigger)配置:

{
  alarmManager: {
    allowWhileIdle: true,
  },
  type: TriggerType.TIMESTAMP,
  timestamp: fireDate,
  repeatFrequency: RepeatFrequency.WEEKLY,
};

通知主体(notification)配置:

{
  title: alertTitle,
  body: alertBody,
  data: userInfo,
  android: {
    channelId,
    importance: AndroidImportance.HIGH,
    pressAction: {
      id: 'default',
      launchActivity: 'default',
      launchActivityFlags: [AndroidLaunchActivityFlag.SINGLE_TOP],
    },
    smallIcon: 'ic_small_icon',
    largeIcon: 'ic_launcher',
    style: alertBody
      ? {
          type: AndroidStyle.BIGTEXT,
          text: alertBody,
        }
      : undefined,
    showTimestamp: true,
    visibility: AndroidVisibility.PUBLIC,
    sound: 'default',
  },
  ios: {
    sound: 'default',
    foregroundPresentationOptions: {
      sound: true,
      alert: true,
      badge: true,
    },
  },
};

咨询诉求

有没有开发者遇到过同类型异常?希望能告知导致该问题的可能原因。

内容的提问来源于stack exchange,提问作者Babu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.30 04:39:20