I am migrating from GCM to FCM. Before we were sending messages to thousands of devices based on a collection of GCM tokens stored on our servers. Now with FCM we are supposed to use topics. This works nicely for FCM generated tokens, but it does not work for old GCM tokens. Can someone confirm that this is the case?
I get a strange error when trying to send a message with an old gcm token. "An error occurred when trying to authenticate to the FCM servers". It looks like an error message bug, because we don't have authentication issues when we use new FCM tokens.
If old tokens are not supported, how do we successfully migrate then?
code i am executing:
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://admob-app-id-3193292840.firebaseio.com"
});
var registrationTokens = [token];
var topic = "test_1234";
var message = {
topic : topic,
data: {'message':JSON.stringify(data)},
android: {
ttl: 36000 * 1000,
priority: 'normal',
collapseKey: "fcm"
}
};
var dryRun = false;
admin.messaging().subscribeToTopic(registrationTokens, topic)
.then(function(response) {
console.log(JSON.stringify(response));
})
.catch(function(error) {
console.log('Error subscribing to topic:', error);
});