Prerequisites
You need a mobile device with Simplifier Mobile Client connected to your Simplifier instance.
Step 1 – Create Notification Data Type
Create a Data Struct for the notification message. I.e., if you want to send the username, text message, and an ID, define a data type with data fields username (String), textMessage (String), and ID (Integer). As running example, we will use the Smart_Maintenance_Struct with data fields user, notif_short_text, notif_no, and notif_longtext:
Step 2 – Define User Group
The group of users who receive the push notifications, can be defined using Simplifier User Groups, or User Roles. I.e., by selecting a group all users assigned to this group will receive the push notification, or in case of role-based definition all users with this role will receive the push notification. In our running example, we will use the group-based definition, and so define a Simplifier User Group ‘Push_Notification_Receivers‘, whose member will receive the push notifications:
Next, configure the two Connector Calls ‘send’ and ‘receive’ as described in Simplifier Documentation.
Step 4 – Send Push Notification
To send push notifications implement the following steps in the Process Designer:
2. Run the ‘JSONStringify’ helper function of the client-side Business Object ‘ITIZ_Utilities’ (Standard Content) for the global variable holding the message data:
Step 5 – Receive Push Notification
To receive push notifications implement the following steps in the Process Designer:
1.In our case, we only want to receive push notifications in mobile mode, i.e., if the app is running on a mobile device, not in the browser of a PC. Therefore, we have to check in a first step whether the app is running on a mobile device. To do so, add an Auto Field ‘MobileClient’ of type ‘Device’ and characteristic ‘Mobile Client’ (in Data Workbench) and use this Auto Field to configure the Condition shape:
2. Use Mobile Action ‘BackgroundMode’, so that push notifications will be received even if the app is running in the background or the display is locked.
3. Before configuring (and connecting) the Connector shape for receiving the push notifications, switch to Asynchronous (!) Connector Call in the settings panel (right hand side). Then, select the Push Connector Call ‘receive’ (specified in Step 3), and connect the Condition shape with the ‘subscribe’ port of the Push Connector shape.
4. Run the ‘JSONParse’ helper function of the client-side Business Object ‘ITIZ_Utilities’ (Standard Content) for the result of the Push Connector Call ‘receive’. To access the output directly, you can use the process output feature when configuring the input mapping of the Business Object.
5. Store the result of the JSONSParse function in the global variable (‘pushNotification’), which is of the data type specified in Step 2:
6. Now you have the message data stored as global variable and can use it as input for the Mobile Action ‘Notification’: