Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the ID of local notification need to be globally unique?

I'm using the react-native-push-notification module to trigger local notification in my React Native apps.

In PushNotification.localNotification(details), the details object takes one id property which can then be used to clear a local notification.

What I'm wondering is: are these IDs shared by all the apps running on the phone or are they specific to the React Native app?

Basically I'm wondering do I need to make it random so that it doesn't conflict with another app, or can it be just an ID specific to my app incremented every time?

like image 790
laurent Avatar asked Aug 31 '25 02:08

laurent


1 Answers

Because it's a local notification I assume it uses NotificationManager.notify to send it.

Here is what the Android documentations says:

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.

The ID should be unique for your app.

like image 84
LordRaydenMK Avatar answered Sep 02 '25 16:09

LordRaydenMK