Push Notifications
Last updated
Last updated
JourneyApps supports sending push notifications addressed to specific users of a JourneyApps application. This is particularly useful for notifying users of certain events, such as when a job is assigned to them.
Push notifications can be configured for a specific model in your Data Model, and a notification is created whenever an object of that type is created in any way on JourneyApps (e.g. from the mobile device, on the JourneyApps App Backend, or via the JourneyApps API)
The recipient of the push notification is determined by a "belongs to user" relationship on the object.
Push notifications are configured in the Data Model of your app, in OXIDE.
To configure push notifications to be sent when a specific type of object is created, add a <notify-user message="" received-field="" recipient-field=""/>
element at the end of a <model/>
definition.
The configuration options in the <notify-user/>
tag are as follows:
Configuration Option | Description |
---|---|
| The message that will be displayed to the user in the push notification. It is an XML Format String, so field values from the object can be dynamically interpolated into the message (see Example 1 below). |
| The name of a datetime field where JourneyApps will automatically store a timestamp indicating when the push notification message was received. |
| The name of a belongs to relationship on the same object that indicates who the recipient of the push notification should be. The model of the relationship must be the mobile user type ( |
| [Optional] The name of an integer field where JourneyApps will pull the badge count from when sending push notifications on iOS. This allows the developer to keep track of the unread message count to display on the app badge. |
Badge Count Support
Setting a custom badge count value by using the badge-count-field
option is intended to be used in conjunction with custom messages and the notifications indicator functionality described in the Navigation component documentation.
If the default messages behavior is used with the badge count feature, then the number on the app badge will not be an accurate reflection of unread messages because the state is tracked on-device.
This feature is only supported on iOS -- the property has no effect on other platforms.
In the example below, we send a push notification to a user whenever a job_card
object is created. Each job card belongs to the user to which it is assigned, so we notify the assigned user that they have received a new job card.
A more flexible way to use push notifications is to create a dedicated model for the notifications. In this way, any message can be sent to any user simply by creating such a "notification" object. You could also send the same message to multiple users by looping through your users and creating a "notification" object for each user.
Note that you can choose any name for the "notification" model. It does not have to be called notification
— the <notify-user/>
element is the only aspect of the above example that determines that the object will trigger push notifications.
A push notification will be sent when a notification
object is created. The app badge count on iOS will be equal to the value of the badge_count
field on the object.
If the user taps on a Push Notification, the JourneyApps Container will be opened, and a data sync will be triggered automatically.
If the app was running in the background, it will be opened on the same view where it was open before. If the app was not running, it will be opened on the main view.
Limitations & Cautions
Please be aware of the limitations to Push Notification inherent to Android, iOS and Desktop.
The Apple Push Notification Service (Apple's service used on iOS) and Google Cloud Messaging (Google's push notification service used on Android) do not guarantee delivery of push notifications, and there may be delays in the delivery of notifications due to external factors, including network connectivity.