Difference between revisions of "Notification"
Line 3: | Line 3: | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
=== Description === | === Description === | ||
− | <translate>Notification class is used to compose and schedule new local notifications. You need to provide an ID of notification to constructor. Using same provided ID you can create a new instance of Notification class and modify existing notification with that ID. Additionally the ID allows you to identify local notification in the table of scheduled local notifications retrieved from [[NotificationManager:getScheduledNotifications]], or table of local notifications that were already displayed using [[NotificationManager:getLocalNotifications]] | + | <translate>Notification class is used to compose and schedule new local notifications. You need to provide an ID of notification to constructor. Using same provided ID you can create a new instance of Notification class and modify existing notification with that ID. Additionally the ID allows you to identify local notification in the table of scheduled local notifications retrieved from [[Special:MyLanguage/NotificationManager:getScheduledNotifications|NotificationManager:getScheduledNotifications]], or table of local notifications that were already displayed using [[Special:MyLanguage/NotificationManager:getLocalNotifications|NotificationManager:getLocalNotifications]] |
− | [[Notification]] consists of notification message, title, sound and number. Only message is the mandatory one. You can combine others as you wish.</translate> | + | [[Special:MyLanguage/Notification|Notification]] consists of notification message, title, sound and number. Only message is the mandatory one. You can combine others as you wish.</translate> |
=== Examples === | === Examples === | ||
'''Create new notification and dispatch right away'''<br/> | '''Create new notification and dispatch right away'''<br/> | ||
Line 46: | Line 46: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
− | [[Notification.new]] ''<translate>creates new notification</translate>''<br/> | + | [[Special:MyLanguage/Notification.new|Notification.new]] ''<translate>creates new notification</translate>''<br/> |
− | [[Notification:cancel]] ''<translate>cancel notification</translate>''<br/> | + | [[Special:MyLanguage/Notification:cancel|Notification:cancel]] ''<translate>cancel notification</translate>''<br/> |
− | [[Notification:dispatchAfter]] ''<translate>Dispatch notification after specified time</translate>''<br/> | + | [[Special:MyLanguage/Notification:dispatchAfter|Notification:dispatchAfter]] ''<translate>Dispatch notification after specified time</translate>''<br/> |
− | [[Notification:dispatchNow]] ''<translate>dispatch notification now</translate>''<br/> | + | [[Special:MyLanguage/Notification:dispatchNow|Notification:dispatchNow]] ''<translate>dispatch notification now</translate>''<br/> |
− | [[Notification:dispatchOn]] ''<translate>dispatch on specified date</translate>''<br/> | + | [[Special:MyLanguage/Notification:dispatchOn|Notification:dispatchOn]] ''<translate>dispatch on specified date</translate>''<br/> |
− | [[Notification:getId]] ''<translate>get id of notification</translate>''<br/> | + | [[Special:MyLanguage/Notification:getId|Notification:getId]] ''<translate>get id of notification</translate>''<br/> |
− | [[Notification:getMessage]] ''<translate>get message of notification</translate>''<br/> | + | [[Special:MyLanguage/Notification:getMessage|Notification:getMessage]] ''<translate>get message of notification</translate>''<br/> |
− | [[Notification:getNumber]] ''<translate>get notification number</translate>''<br/> | + | [[Special:MyLanguage/Notification:getNumber|Notification:getNumber]] ''<translate>get notification number</translate>''<br/> |
− | [[Notification:getSound]] ''<translate>get sound of notification</translate>''<br/> | + | [[Special:MyLanguage/Notification:getSound|Notification:getSound]] ''<translate>get sound of notification</translate>''<br/> |
− | [[Notification:getTitle]] ''<translate>get title of notification</translate>''<br/> | + | [[Special:MyLanguage/Notification:getTitle|Notification:getTitle]] ''<translate>get title of notification</translate>''<br/> |
− | [[Notification:setNumber]] ''<translate>set notification number</translate>''<br/> | + | [[Special:MyLanguage/Notification:setNumber|Notification:setNumber]] ''<translate>set notification number</translate>''<br/> |
− | [[Notification:setSound]] ''<translate>set notification sound</translate>''<br/> | + | [[Special:MyLanguage/Notification:setSound|Notification:setSound]] ''<translate>set notification sound</translate>''<br/> |
− | [[Notification:setTitle]] ''<translate>set the title of notification</translate>''<br/> | + | [[Special:MyLanguage/Notification:setTitle|Notification:setTitle]] ''<translate>set the title of notification</translate>''<br/> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
− | [[Notification.DEFAULT_SOUND]]<br/> | + | [[Special:MyLanguage/Notification.DEFAULT_SOUND|Notification.DEFAULT_SOUND]]<br/> |
|} | |} |
Revision as of 16:33, 23 August 2018
Supported platforms:
Available since: Gideros 2011.6
Description
Notification class is used to compose and schedule new local notifications. You need to provide an ID of notification to constructor. Using same provided ID you can create a new instance of Notification class and modify existing notification with that ID. Additionally the ID allows you to identify local notification in the table of scheduled local notifications retrieved from NotificationManager:getScheduledNotifications, or table of local notifications that were already displayed using NotificationManager:getLocalNotifications
Notification consists of notification message, title, sound and number. Only message is the mandatory one. You can combine others as you wish.
Examples
Create new notification and dispatch right away
local note = Notification.new(1)
note:setTitle("Notification app")
note:setMessage("Do you see me?")
note:setSound("./some_sound.wav")
note:dispatchNow()
Create new notification and dispatch after one hour with repeating period of one day
local note = Notification.new(2)
note:setTitle("Notification app")
note:setMessage("I will bother you each day")
note:dispatchAfter({hour = 1}, {day = 1})
Create new notification and dispatch on specific date in specific time
local note = Notification.new(3)
note:setTitle("Notification app")
note:setMessage("Happy Birthday")
note:dispatchOn({year = 2013, month = 8, day = 1, hour = 9, min = 0, sec = 0})
Modifying existing scheduled notification
--id of notification to modify
local id = 1
--retrieve shared instance
local mngr = NotificationManager.getSharedInstance()
--retrieve table with scheduled notifications
local t = mngr:getScheduledNotifications()
--check if id is in it
if t[id] then
--notification is still scheduled
--let's modify it by creating new instance with same id
local note = Notification.new(id)
note:setTitle("New title")
note:setMessage("New message")
--if we want to modify dispatch time we need to redispatch it
note:dispatchAfter({day = 1})
end
MethodsNotification.new creates new notification |
EventsConstants |