I'm wrapping up the development of a mobile app (ionic, but irrelevant), backed by a backend developed in Ruby on Rails 5, irrelevant again since this is more of a theoretical question/issue.
The thing here is, given the fact that users in the mobile application can log in or not (they've got a bunch of functionalities, and maybe half of those can be accessed by not logged in users), how should I handle the storage of the notification itself and the read state? Note: with notification I'm not referring to a push notification, but to the "message" that stays in a side menu inside the app (I've got push delivery covered).
The main issue here is: I want to be able to track the read notifications to prevent them from being marked as unread in case the user reinstalls the app (imagine 50 unread notifications just because you reinstalled).
I began with a model as follows for storing the notifications in the backend:
With this model, I'd insert a row for every user that needs to be notified, and track with a boolean column whether it was read or not. The issue is, only registered users could have notifications.
A second option is the removal of the user_id reference and the "read" attribute server-side, and assume I'm always gonna notify everyone, not some users. But now, I need a way to track which notifications were read. I could do that locally in the mobile app storing some ids in the local storage, but then again those would be deleted in case of reinstall.
A third option I've thought of, is to implement the second option with an "expiry" column server-side, which indicates when a notification should stop being "unread" by default in case of a new app install. This is the best I've got so far, but I'm not really convinced.
I know I'm asking for a lot of things here, but I am just looking for a good implementation model someone has made before, since I've been unable to find anything googling, and I'm sure this is a heavily repeated design pattern.
Thank you!
Built-in voice Notifications for Android phonesTalkback will read out loud notifications as they arrive along with everything on your screen (not just notifications). However, this changes the way you interact with your phone, which might be a drawback if you are looking for app to only read out loud notifications.
Push notifications look like SMS text messages and mobile alerts, but they only reach users who have installed your app. All the mobile platforms – iOS, Android, Fire OS, Windows and BlackBerry – have their own services for supporting push.
When your app is in the background, Android directs notification messages to the system tray. A user tap on the notification opens the app launcher by default. This includes messages that contain both notification and data payload (and all messages sent from the Notifications console).
Android proposes several types of notifications to inform the user: notifications in the system bar. sound notifications.
Before you send a notification to user, generate a hash, place it into your Notification table and in the notification body. On mobile side, when user opens the push notification - you need to send a request to the server with that hash and notification-type (if you want). Server gets the hash and finds out which user and notes that the notification was read, and you can set your flag (isRead
) to true,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With