android - 本地通知的ID是否需要全局唯一?

标签 android react-native module push-notification

我正在使用 react-native-push-notification在我的 React Native 应用程序中触发本地通知的模块。

PushNotification.localNotification(details) 中,details 对象采用一个 id 属性,然后可以使用该属性清除本地通知。

我想知道的是:这些 ID 是由手机上运行的所有应用程序共享的,还是特定于 React Native 应用程序的?

基本上我想知道我是否需要使其随机以便它不会与另一个应用程序冲突,或者它是否可以只是一个特定于我的应用程序的 ID 每次递增?

最佳答案

因为它是本地通知,所以我假设它使用 NotificationManager.notify发送它。

Android 文档是这样说的:

Post a notification to be shown in the status bar. If a notification with the same id has already been posted by your application and has not yet been canceled, it will be replaced by the updated information.

您的应用的 ID 应该是唯一的。

关于android - 本地通知的ID是否需要全局唯一?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47501311/

相关文章:

react-native - 滚动时禁用 TouchableOpacity 突出显示

javascript - 超时获取 - React Native

javascript - 无法将 webpack 捆绑的 UMD 库作为 ES6 导入导入

python - django apache mod-wsgi 挂起从 .so 文件导入 python 模块

typescript - 如何在 TypeScript 中将导入的模块分配给具有索引签名的字典类型?

android - 如何将logcat文本导入Android Eclipse

android - 从 ViewModel 观察 LiveData

java - 在 Android 上运行时,来自网页的 Httpget 不会返回内容

android - 应用内计费 Android - 无结账屏幕

react-native - 安卓 'react-native-gesture-handler' 错误