Register tokens
Token registration can now be done using the callExtension method provided by the CometChat SDK. The token can be FCM token or APNs token and VoIP token. This can be achieved using the code snippet below: For FCM token:Get tokens
This provides a list of all the Push Notifications tokens that have been registered for the current user. The tokens are segregated based on the platform.Delete tokens
Token deletion is handled implicitly by theCometChat.logout()
method. That is, once the user is logged out of the current CometChat session, his/her registered Push Notification token automatically gets deleted.
The same can be achieved explicitly by making a call to the extension using callExtension
method as shown below. However, the token that is deleted belongs to the current session of the end-user by passing all=false
as a parameter.
All the tokens for the current user will be deleted if you pass
all=true
. This needs to be used with care as the other logins of the current user will stop receiving Push Notifications.