Firebase register token for FCM doesn't work after app transfer
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 |
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 |
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 '18 at 1:02
Spencer Shelton
asked Nov 20 '18 at 2:33


Spencer SheltonSpencer Shelton
7316
7316
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
0
active
oldest
votes
0
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.
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