How to do it :
If it’s a button make 2 images. One with a dot and one a Normal one. Use tinydb and Change Data when there is a notification. For example, The value of the tag notification can be set to true or false and in the blocks… If it’s true change the image to the notification one else set it to the Normal one
now what if i have to send a notification after 1 hour (let it be any time after this event), the value is stored in tiny db that the user has seen the notification, and it will always show Notification has been read
so when should be the event of clearing tiny db tags should be raised, i hope you get what am saying
Simply store the current time in tinyDB or Firebase. When the app opens again by the user then calculate the time gap between now and the stored value.
if(difference >= reqired_time_gap){
//perform any task
}
take exapmple of facebook, when you open the app, it has notifications, you clicked them and the notification count goes away, and when again a notification comes the notification badge again comes in the app,
When the application opens check for the notification massage.
GetNotificationFromFirebase();
When got the value.
Check for the last notification stored in the tiny DB.
if(last massage == firebase_massage)
{
//no need to perform any task
}else{
//show a toast massage
//store the new massage to the tinyDB
// and what ever task you want
}
but my concern is this… let me explain you how I send notifications to my app
I use One Signal to make users aware that there is a notification in the app.
Here i used firebase, if firebase tag value = yes then it will show NOTIFICATION ICON otherwise it will show CHECK ICON and TinyDB will store value that user has seen message right ?
There is no no problem till now !
Actual problem is, Now the firebase value is set to YES and user has seen message, now if I again send a notification using one signal it should again show NOTIFICATION ICON which will not happen coz tiny db has stored SEEN tag !
what should be done so that when i send notification using ONE SIGNAL, the tiny db tag gets cleared and it again shows NOTIFICATION ICON