The LocalNotifications external object enables your app to alert users of scheduled events or alarms in the background, with no servers required.
It does not have any.
Creates a set of local notifications (or alerts) by indicating when each of them will be triggered and the text that will be displayed. It returns 0 if the operation ends successfully.
Return value |
Numeric(5.0) |
Parameters |
alerts:LocalNotificationsInfo |
ListAlerts method
Lists every local notification (or alert) previously created.
Return value |
LocalNotificationsInfo |
Parameters |
None |
RemoveAlerts method
Removes a set of local notifications (or alerts), each of them identified by its triggered timestamp and its text. It returns 0 if the operation ends successfully.
Return value |
Numeric(5.0) |
Parameters |
alerts:LocalNotificationsInfo |
RemoveAllAlerts method
Removes every local notification (or alert) from the device. It returns 0 if the operation ends successfully.
Return value |
Numeric(5.0) |
Parameters |
None |
Events
It does not have any.
In addition to the LocalNotifications external object, the LocalNotificationsInfo Structured Data Type (SDT) is used to define the configuration of the Local Notification.
It is a collection of items, each one containing the following:
You can define as many Local Notifications as you want. A single item on the LocalNotificationsInfo collection is equivalent to one Local Notification.
Consider a Panel object with its Main program property = True.
The Panel Layout contains a button that is associated with the 'NotificationEvent' event:
Event 'NotificationEvent'
Composite
&AlertDateTime = Now()
&AlertDateTime = &AlertDateTime.AddSeconds(10)
&LocalNotItem = New() //The notification is created
&LocalNotItem.DateTime = &AlertDateTime
&LocalNotItem.Text = !'You have a new notification'
&LocalNotItem.Event.Name = "EventCallType" //Name of the event to be called. It must be defined in the Panel.
&localNotEventsParameters.Name = "callParam" //Variable name defined in the Panel and used in the event to be called.
&localNotEventsParameters.Value = "PopUp" //Value assigned to the previous variable name.
&LocalNotItem.Event.Parameters.Add(&LocalNotEventsParameters)
&LocalNotInfo.Add(&LocalNotItem)
EndComposite
Endevent
Event "EventCallType"
Composite
InfoPanel.CallOptions.Type = &callParam //The &callParam value is "Popup"
InfoPanel.Call(&callParam) //The Panel is called with the chosen CallOptions Type as a parameter
EndComposite
EndEvent
When tapping on the Panel button, the 'NotificationEvent' event is executed. This event loads a variable based on the LocalNotificationsInfo SDT. So, the EventCallType event will be executed when indicated (&AlertDateTime was assigned). In this example, the EventCallType event calls a Panel (InfoPanel) with the PopUp mode.
HowTo: Use LocalNotifications external object in Native Mobile apps
Push Notifications in Native Mobile Applications (servers required)