Push Notifications
Last updated
Was this helpful?
Last updated
Was this helpful?
If you purchased a Gravity Native or Gravity Power plan, you can send push notifications from the server to mobile devices on iOS or Android.
When a user provides permission in-app to send push notifications, a push token for their device is stored in the database.
To send a notification, simple call the send method of the notification helper and pass an array of tokens, plus the message you want to send.
You will probably only ever send one-off notifications based on a user's actions, however if you need to send hundreds of messages simultaneously, you may want to consider
Failing to stop sending notifications to an unregistered device may result in being banned from sending push notifications by Apple and/or Google.
If a user disables push notifications for your service at any point, Gravity will remove the device token from the database the next time you attempt to send a notification and there is a DeviceNotRegistered
error.