Tech Tip: How to send mobile app push notification that redirects to entity
PRODUCT: 4D for iOS | VERSION: 18 R | PLATFORM: Mac
Published On: June 21, 2021
Implementing the code for push notifications in a 4D for iOS project generally follows this process. First, create a new instance of the Push Notification class from the Mobile App Server component.
$pushNotification:=MobileAppServer.PushNotification.new() |
Then, create a notification object to hold the notification message and synchronization settings. Finally, use the send method and pass in the notification and recipient as arguments.
$pushNotification.send($notification;$recipient) |
To send a push notification that redirects the user to an entity’s page, instead of using the send method, use the open method.
$pushNotification.open($entity;$notification;$recipient) |
This will send a push notification that, when the user taps the notification, takes them to the detail page of the entity. Note that, unlike the send method, this method requires passing the entity in the first parameter. This is to allow 4D for iOS to know which entity to show.