Skygear Push Basics
You need to register the devices before sending them push notifications.
It is suggested that you register a device with remote server on every launch. Since the container remembers the device ID when the device is registered on the remote server, it will reuse an existing device ID whenever you try to register the current device.
You should also request a remote notification token at some point in the program. If it is appropriate to ask the user for permission for remote notification, you can also do so when the application launches.
When a device token is registered with Apple Push Notification Service, you should register the device once again by updating the registration with a device token.
When the device is registered on the remote server, a device ID will be
available to the client application. If you register the current device
using the above convenient methods, the device ID is returned from
registeredDeviceID property on the container.
Sending push notification from cloud code
To send push notifications through cloud code, please refer to the Cloud Code Guide: Push Notifications.
Sending push notification to users
Sending push notification to devices
When a device is registered, it is associated with the authenticated user. Therefore it is necessary to unregister the device when the user is no longer associated with the device, for example when the user logs out.