Overview
Local notification purpose is to notify users to sue the mobile app for better learning experience.
Here user will get notification on timely basis, and the notification will be purely locally generated. For this, when the user installs the application and run it for the first time, based on certain configurations a notification event will be set on a particular date* and time*, which will be triggered at specified time with some message*.
...
Code Block |
---|
[ { time: "19:30", day: "Tuesday", repeat: 7 occurrence: 4, title: "{\"en\":\"Message\"}", msg: "{\"en\":\"Description for Notification\"}" } ] |
Property | type | Value (Example) | Description |
---|---|---|---|
time | string | 20:15 | time in 24 hours |
day | string | "Tuesday" | any day of week ["Moday", "Tuesday"... "Sunday"] Note: either of |
date | int | 14 | date of the month [1-31] Note: either of |
repeat | int | 5 | number of days notification to be repeated |
occurrence | int | 10 | number of time to repeat the notification |
title | string | Tittle for notification | |
msg | string | Description of notification |
Solution 2:
A)
A notification will be triggered on every month 20th at 7:00 PM (19:00) from the next coming date.
...
Code Block |
---|
{ time: "10:00", interval: 5, endRepeat: { weeks: 6 } title: "{\"en\":\"Message\"}", msg: "{\"en\":\"Description for Notification\"}" } |
Property | type | Value (Example) | Description |
---|---|---|---|
time | string | 20:15 | time in 24 hours |
day | string | "Tuesday" | any day of week ["Monday", "Tuesday"... "Sunday"] Note: either of |
date | int | 14 | date of the month [1-31] Note: either of |
repeat | string | monthly | repeat pattern |
string | weekly | ||
string | yearly | ||
string | daily | ||
title | string | Tittle for notification | |
msg | string | Description of notification | |
endRepeat | object | object with some properties |
For repeat
object:
Property | type | Value (Example) | Description |
---|---|---|---|
months | int | 4 | after N number of months should stop notification Note: if given then example: 20 |
weeks | int | 5 | after N number of weeks should stop notification Note: if given then example: "Tuesday" |
days | int | 3 | after N number of days should stop notification Note: if given then |
repeatCount | int | 10 | should be repeated for N number of times only |
Pros and Cons
Solution | Pros | Cons |
---|---|---|
1 | Simple logic not too many conditions for calculating date. | While setting passing the values we've to calculate the number of occurrences based on when and how long we want to continue the notification. |
2 | Has just have to pass the values it'll automatically calculate the occurrences and stop if required. | Logic will be complex and have to take care of each every value which needs to be passed. |
Using In App Notification Payload
After the discussion, we'll be using the same payload structure as described in In App Notification.
Code Block |
---|
{ "id": 114, // id of the notification will be integer, which will be unique "type": 1, // Notification type will be integer - Their can different notification types, like DOWNTIME, GREETINGS, NON-DISPLAY and OTHERS "data":{ // action data contains all the information related to type of the notification, start, msg, notification title start: '2019/05/20 19:00' // first triggered on specified date, and onwards weekly interval: 'week' translations: { "en": { "title": "Title text", "msg": "Descriptive message" }, "default" : { // any default language, if language translation not available then to be used "title": "Title text", "msg": "Descriptive message" } } } } |
Property | type | Value (Example) | Description |
---|---|---|---|
id | int | id of the notification will be integer, which will be unique | |
type | enum | Notification type will be integer - Their can different notification types, like DOWNTIME, GREETINGS, NON-DISPLAY and OTHERS | |
data |
obj | translations | Object specifying the language, Example en | |
obj | interval | Interval specifies the time interval difference between 2 notification. Example, for weekly once |
7
.on a specific weekday Ex: "interval": "weekday" should go with 2 format of | ||
obj | start | Date and time from when the notification will be triggered for the first time.
|
|
| ||
obj | occurrence | Number of times the notification should be triggered, if null then notification will be shown infinite times on the specified date and time or weekday |
Translations
object contains object with these properties with key specifying language code
Property | type | Value (Example) | Description |
---|---|---|---|
en | obj | title | Title of notification, should be string |
obj | msg | Description of notification, should be string | |
hi | obj | title | Title of notification, should be string |
obj | msg | Description of notification, should be string | |
default | obj | title | Title in any default language |
obj | msg | Message in any default language |