[Local Notifications Plugin] How to schedule a local notification?

[Local Notifications Plugin] How to schedule a local notification?

  
Forge Component
(2)
Published on 2016-12-15 by Outsystems R&D
2 votes
Published on 2016-12-15 by Outsystems R&D

The procedure below guides you through the scheduling of a local notification.

1.Start by installing the Local Notifications Plugin from the OutSystems Forge. The fastest way to do this is to go to the OutSystems tab in your development environment and install from there.

2. Add the Local Notifications Plugin to Your Application: On your application, use “Manage Dependencies…” to add a reference to the Local Notifications plugin.


3. Define the user action that will trigger the notification (this could be a button, for example).

4. Next, create a local variable of type LocalNotification in the screen where you are configuring your notification and assign values to the fields of the local variable.
We recommend you to set the ID of your notification to make it easier to find it in case you want to add extra actions, for example: ClearNotifications. Keep in mind that this ID must be unique.


5. Add another local variable of type List of LocalNotification, and use the system action “ListAppend” to add the local notification variable to the list.

6. Then add the ScheduleNotifications action to the flow and define the input parameter “NotificationList” as the list created in the previous step.

7. Generate your app.

Hi Marina,

Follow exactly what you have wrote, however there is no output when I clicked the button.

May I know what should be the correct result (where is the notification stored and how does it show)?

I tried it and its working... Thanks for detailed procedure...

Marina Calado wrote:

The procedure below guides you through the scheduling of a local notification.

1.Start by installing the Local Notifications Plugin from the OutSystems Forge. The fastest way to do this is to go to the OutSystems tab in your development environment and install from there.

2. Add the Local Notifications Plugin to Your Application: On your application, use “Manage Dependencies…” to add a reference to the Local Notifications plugin.


3. Define the user action that will trigger the notification (this could be a button, for example).

4. Next, create a local variable of type LocalNotification in the screen where you are configuring your notification and assign values to the fields of the local variable.
We recommend you to set the ID of your notification to make it easier to find it in case you want to add extra actions, for example: ClearNotifications. Keep in mind that this ID must be unique.


5. Add another local variable of type List of LocalNotification, and use the system action “ListAppend” to add the local notification variable to the list.

6. Then add the ScheduleNotifications action to the flow and define the input parameter “NotificationList” as the list created in the previous step.

7. Generate your app.


Hi Marina,

I tested Local Notifications Plugin with Android. I'm using it in conjunction with Pusher to notify the user

that a new Pusher event has arrived. All works fine until I click the notification itself. This seems to stop

the plugin working properly or at least playing the default sound. Any idea why this happens?


Kind Regards

Joerg Peters


 


Hello all,

I followed all the steps that Marina posted, and it worked just fine. However, this is only when the button is clicked by user.

What options do you use, to check for notifications, while the application is in background and while open?

The method I tried is: Creating a WebLock for Notification Check, where OnInitialize a Javscript setInterval function (to click the button with check) is started. But this led to a freeze of application, and nothing was working. My interval was every 5s (5000 in a script), and the action itself was to start a synchronization in background, and Schedule all the notifications the way Marina described.


Best Regards
Kasparas

Hi Kasparas,

I stopped using the plugin because of your first statement and used the background plugin, the Pusher plugin, the TTS plugin and a HTML5 audio player. Instead of audio player one could use native device sounds. This works in device background mode like a charm. We use this in a mobile CRM solution to notify an engineer about ticket change status.


Kind Regards

Joerg