- iOS: basically ask token to APNs and notify to backend service
- FCM: notify backend service whenever the token is refreshed because FCM token refresh timing is clarified
Never cache device tokens in your app; instead, get them from the system when you need them. APNs issues a new device token to your app when certain events happen. The device token is guaranteed to be different, for example, when a user restores a device from a backup, when the user installs your app on a new device, and when the user reinstalls the operating system. Fetching the token, rather than relying on a cache, ensures that you have the current device token needed for your provider to communicate with APNs. When you attempt to fetch a device token but it has not changed, the fetch method returns quickly.
In APNs, you don't know when to expire / refresh token, always fetch token and sync with backend service.
GCM has already been deprecated at May, 2019.
The registration token may change when:
> The app deletes Instance ID > The app is restored on a new device > The user uninstalls/reinstall the app > The user clears app data.