NativeScript / NativeScript/plugins
[@nativescript/local-notifications] Android - Message received callback fires multiple times
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 206
- 派生
- 123
- 平均合并
- 2 天 1 小时
- 30 天内合并 PR
- 1
描述
Android version: 11
nativescript CLI: 8.2.3
@nativescript/android: 8.2.2
@nativescript/local-notifications: 6.0.0
When I tap a local notification, the onReceived function is called and all data is present.
LocalNotifications.addOnMessageReceivedCallback((message) => {
// message: { id: 6471, title: 'TITLE', body: `BODY`, payload: {...}, badge: 1, ...}
});
However, if I open to the app switcher and return to my app, the function is called again but the data object is almost empty. Every time I switch back to the app the callback fires.
{ event: 'default', foreground: true }
I have not tested yet on iOS or different Android versions.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 Android 11 上使用 @nativescript/android 8.2.2 和 @nativescript/local-notifications 6.0.0 复现此问题。首先跟踪从应用切换器返回时的 addOnMessageReceivedCallback;当点击通知时 callback 会触发,但后续从应用切换器返回时不会触发,同时保留通知数据,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, javascript, typescript
- 领域
- mobile-dev
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100