Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the registration token refresh whenever the app is launched in iOS?

When I install app for the first time and it asks for the permission for getting notification, if I press yes then the Device token is generated, but whenever I relaunch the app, I get the error:

Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)

Can anyone tell whether the device token is generated every time the app is launched?

like image 741
anvesh yadav Avatar asked Feb 03 '17 09:02

anvesh yadav


People also ask

Does the iOS device token change?

APNs issues a new token when the 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. If you ask the system to provide the token each time, you're guaranteed to get an up-to-date token.

Does FCM token change iOS?

The registration token may change when: The app is restored on a new device. The user uninstalls/reinstall the app. The user clears app data.

Is device token unique in iOS?

Device Token: A device token is an identifier for the Apple Push Notification System for iOS devices. Apple assigns a Device Token on a per-app basis (iOS 7 and later) which is used as a unique identifier for sending push notifications.


1 Answers

Nope. A (new) token is not generated every time the app is launched. It is generated on initial launch (i.e. first launch after app install). From the docs:

By default, the FCM SDK generates a registration token for the client app instance on initial startup of your app.

But it may change because of the following scenarios (also from the docs):

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.
like image 79
AL. Avatar answered Oct 06 '22 00:10

AL.