Firebase register token for FCM doesn't work after app transfer
up vote
0
down vote
favorite
Recently transferred my app to a new Apple ID. I created/upload all of the new certificates for push notifications to firebase console (APN Auth Key). Also, set up other IOS certificates ("IOS distribution", "Apple Push Services") and made sure appID was added with push notifications enabled. My problem is the old firebase register tokens already stored in my database don't seem to work anymore. Once I reinstall the app or get the token to refresh the push notifications work. But again if I were to use the old tokens that were created before the app transfer the push notification fails to send.
What would be the best way to create new push notification tokens for users that have the old token? After reading the firebase docs the only way to create a new token would be if the user does one of the three things below.
- The app is restored on a new device
- The user uninstalls/reinstall
- The user clears app data.
Yet all of those things seem like something the user would have to do themselves.
After doing a bit more research I found this similar issue Change/update Firebase notification token or instance id forcefully via code?. There suggestion was to
1) Delete old Token
let instance = InstanceID.instanceID()
instance.deleteID { (error) in
print(error.debugDescription)
}
2) Request for new token
if let token = InstanceID.instanceID().token() {
print("Token : (token)");
} else {
print(“Error: unable to fetch token");
}
Messaging.messaging().shouldEstablishDirectChannel = true
Which worked, when I call deleteID on the instanceID the MessagingDelegate's "didReceiveRegistrationToken" is called with the new fcmToken. I then update Database with new token. But this new fcmToken does not work, when I try to send a push notification through the firebase cloud messaging console nothing is received on the phones end. Yet if I were to delete the app and reinstall it, the first fcmToken works. The App receives all push notifications until I try to force update the FCMToken.
Again my goal is to update users with old FCMTokens to new ones so they can receive push notifications without having to reinstall the app or get the old ones to work.
ios swift firebase firebase-cloud-messaging
add a comment |
up vote
0
down vote
favorite
Recently transferred my app to a new Apple ID. I created/upload all of the new certificates for push notifications to firebase console (APN Auth Key). Also, set up other IOS certificates ("IOS distribution", "Apple Push Services") and made sure appID was added with push notifications enabled. My problem is the old firebase register tokens already stored in my database don't seem to work anymore. Once I reinstall the app or get the token to refresh the push notifications work. But again if I were to use the old tokens that were created before the app transfer the push notification fails to send.
What would be the best way to create new push notification tokens for users that have the old token? After reading the firebase docs the only way to create a new token would be if the user does one of the three things below.
- The app is restored on a new device
- The user uninstalls/reinstall
- The user clears app data.
Yet all of those things seem like something the user would have to do themselves.
After doing a bit more research I found this similar issue Change/update Firebase notification token or instance id forcefully via code?. There suggestion was to
1) Delete old Token
let instance = InstanceID.instanceID()
instance.deleteID { (error) in
print(error.debugDescription)
}
2) Request for new token
if let token = InstanceID.instanceID().token() {
print("Token : (token)");
} else {
print(“Error: unable to fetch token");
}
Messaging.messaging().shouldEstablishDirectChannel = true
Which worked, when I call deleteID on the instanceID the MessagingDelegate's "didReceiveRegistrationToken" is called with the new fcmToken. I then update Database with new token. But this new fcmToken does not work, when I try to send a push notification through the firebase cloud messaging console nothing is received on the phones end. Yet if I were to delete the app and reinstall it, the first fcmToken works. The App receives all push notifications until I try to force update the FCMToken.
Again my goal is to update users with old FCMTokens to new ones so they can receive push notifications without having to reinstall the app or get the old ones to work.
ios swift firebase firebase-cloud-messaging
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Recently transferred my app to a new Apple ID. I created/upload all of the new certificates for push notifications to firebase console (APN Auth Key). Also, set up other IOS certificates ("IOS distribution", "Apple Push Services") and made sure appID was added with push notifications enabled. My problem is the old firebase register tokens already stored in my database don't seem to work anymore. Once I reinstall the app or get the token to refresh the push notifications work. But again if I were to use the old tokens that were created before the app transfer the push notification fails to send.
What would be the best way to create new push notification tokens for users that have the old token? After reading the firebase docs the only way to create a new token would be if the user does one of the three things below.
- The app is restored on a new device
- The user uninstalls/reinstall
- The user clears app data.
Yet all of those things seem like something the user would have to do themselves.
After doing a bit more research I found this similar issue Change/update Firebase notification token or instance id forcefully via code?. There suggestion was to
1) Delete old Token
let instance = InstanceID.instanceID()
instance.deleteID { (error) in
print(error.debugDescription)
}
2) Request for new token
if let token = InstanceID.instanceID().token() {
print("Token : (token)");
} else {
print(“Error: unable to fetch token");
}
Messaging.messaging().shouldEstablishDirectChannel = true
Which worked, when I call deleteID on the instanceID the MessagingDelegate's "didReceiveRegistrationToken" is called with the new fcmToken. I then update Database with new token. But this new fcmToken does not work, when I try to send a push notification through the firebase cloud messaging console nothing is received on the phones end. Yet if I were to delete the app and reinstall it, the first fcmToken works. The App receives all push notifications until I try to force update the FCMToken.
Again my goal is to update users with old FCMTokens to new ones so they can receive push notifications without having to reinstall the app or get the old ones to work.
ios swift firebase firebase-cloud-messaging
Recently transferred my app to a new Apple ID. I created/upload all of the new certificates for push notifications to firebase console (APN Auth Key). Also, set up other IOS certificates ("IOS distribution", "Apple Push Services") and made sure appID was added with push notifications enabled. My problem is the old firebase register tokens already stored in my database don't seem to work anymore. Once I reinstall the app or get the token to refresh the push notifications work. But again if I were to use the old tokens that were created before the app transfer the push notification fails to send.
What would be the best way to create new push notification tokens for users that have the old token? After reading the firebase docs the only way to create a new token would be if the user does one of the three things below.
- The app is restored on a new device
- The user uninstalls/reinstall
- The user clears app data.
Yet all of those things seem like something the user would have to do themselves.
After doing a bit more research I found this similar issue Change/update Firebase notification token or instance id forcefully via code?. There suggestion was to
1) Delete old Token
let instance = InstanceID.instanceID()
instance.deleteID { (error) in
print(error.debugDescription)
}
2) Request for new token
if let token = InstanceID.instanceID().token() {
print("Token : (token)");
} else {
print(“Error: unable to fetch token");
}
Messaging.messaging().shouldEstablishDirectChannel = true
Which worked, when I call deleteID on the instanceID the MessagingDelegate's "didReceiveRegistrationToken" is called with the new fcmToken. I then update Database with new token. But this new fcmToken does not work, when I try to send a push notification through the firebase cloud messaging console nothing is received on the phones end. Yet if I were to delete the app and reinstall it, the first fcmToken works. The App receives all push notifications until I try to force update the FCMToken.
Again my goal is to update users with old FCMTokens to new ones so they can receive push notifications without having to reinstall the app or get the old ones to work.
ios swift firebase firebase-cloud-messaging
ios swift firebase firebase-cloud-messaging
edited Nov 21 at 1:02
asked Nov 20 at 2:33
Spencer Shelton
6816
6816
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385386%2ffirebase-register-token-for-fcm-doesnt-work-after-app-transfer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown