Firebase notifications - subscribing to topics using iOS FCM token failing all the time… using C# API
up vote
0
down vote
favorite
I have an App - Android and iOS with a partial web view.
I'm using a C# API back end and notifications via Firebase Cloud messaging works fine for Android, especially subscribing and unsubscribing to topics using the "registered" FM token.
Every time I try to subscribe to a topic using a FCM token that comes from an iOS device it fails.
I'm using very simple code to add tokens to topics e.g.
using (var httpRequest = new HttpRequestMessage(HttpMethod.Post, "https://iid.googleapis.com/iid/v1/" + [fcmToken] + "/rel/topics/" + [topic name]))
{
httpRequest.Headers.TryAddWithoutValidation("Authorization", [server key]);
httpRequest.Headers.TryAddWithoutValidation("Sender", [sender id]);
httpRequest.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
using (var httpClient = new HttpClient())
{
var result = await httpClient.SendAsync(httpRequest);
if (result.IsSuccessStatusCode)
{
//success
}
else
{
//failed
}
}
}
Has anyone had any experience like this or a solution that I'm missing as to why iOS tokens are not getting subscribed to topics?
c# android ios firebase firebase-cloud-messaging
add a comment |
up vote
0
down vote
favorite
I have an App - Android and iOS with a partial web view.
I'm using a C# API back end and notifications via Firebase Cloud messaging works fine for Android, especially subscribing and unsubscribing to topics using the "registered" FM token.
Every time I try to subscribe to a topic using a FCM token that comes from an iOS device it fails.
I'm using very simple code to add tokens to topics e.g.
using (var httpRequest = new HttpRequestMessage(HttpMethod.Post, "https://iid.googleapis.com/iid/v1/" + [fcmToken] + "/rel/topics/" + [topic name]))
{
httpRequest.Headers.TryAddWithoutValidation("Authorization", [server key]);
httpRequest.Headers.TryAddWithoutValidation("Sender", [sender id]);
httpRequest.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
using (var httpClient = new HttpClient())
{
var result = await httpClient.SendAsync(httpRequest);
if (result.IsSuccessStatusCode)
{
//success
}
else
{
//failed
}
}
}
Has anyone had any experience like this or a solution that I'm missing as to why iOS tokens are not getting subscribed to topics?
c# android ios firebase firebase-cloud-messaging
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have an App - Android and iOS with a partial web view.
I'm using a C# API back end and notifications via Firebase Cloud messaging works fine for Android, especially subscribing and unsubscribing to topics using the "registered" FM token.
Every time I try to subscribe to a topic using a FCM token that comes from an iOS device it fails.
I'm using very simple code to add tokens to topics e.g.
using (var httpRequest = new HttpRequestMessage(HttpMethod.Post, "https://iid.googleapis.com/iid/v1/" + [fcmToken] + "/rel/topics/" + [topic name]))
{
httpRequest.Headers.TryAddWithoutValidation("Authorization", [server key]);
httpRequest.Headers.TryAddWithoutValidation("Sender", [sender id]);
httpRequest.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
using (var httpClient = new HttpClient())
{
var result = await httpClient.SendAsync(httpRequest);
if (result.IsSuccessStatusCode)
{
//success
}
else
{
//failed
}
}
}
Has anyone had any experience like this or a solution that I'm missing as to why iOS tokens are not getting subscribed to topics?
c# android ios firebase firebase-cloud-messaging
I have an App - Android and iOS with a partial web view.
I'm using a C# API back end and notifications via Firebase Cloud messaging works fine for Android, especially subscribing and unsubscribing to topics using the "registered" FM token.
Every time I try to subscribe to a topic using a FCM token that comes from an iOS device it fails.
I'm using very simple code to add tokens to topics e.g.
using (var httpRequest = new HttpRequestMessage(HttpMethod.Post, "https://iid.googleapis.com/iid/v1/" + [fcmToken] + "/rel/topics/" + [topic name]))
{
httpRequest.Headers.TryAddWithoutValidation("Authorization", [server key]);
httpRequest.Headers.TryAddWithoutValidation("Sender", [sender id]);
httpRequest.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
using (var httpClient = new HttpClient())
{
var result = await httpClient.SendAsync(httpRequest);
if (result.IsSuccessStatusCode)
{
//success
}
else
{
//failed
}
}
}
Has anyone had any experience like this or a solution that I'm missing as to why iOS tokens are not getting subscribed to topics?
c# android ios firebase firebase-cloud-messaging
c# android ios firebase firebase-cloud-messaging
edited Nov 7 at 12:47
KENdi
5,6492821
5,6492821
asked Nov 7 at 11:54
Paul Deehan
2413
2413
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Seeing as your code works fine for Android, but not for iOS I would follow the differences you need to pay attention to:
- Did you initialize Firebase correctly for iOS? You might need to manually map your APN token to the Firebase token (https://firebase.google.com/docs/cloud-messaging/ios/client)
- Did you upload the APN certificate to Firebase? (https://firebase.google.com/docs/cloud-messaging/ios/certs)
- Do you correctly use the Notification Center if you want to display notifications?
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Seeing as your code works fine for Android, but not for iOS I would follow the differences you need to pay attention to:
- Did you initialize Firebase correctly for iOS? You might need to manually map your APN token to the Firebase token (https://firebase.google.com/docs/cloud-messaging/ios/client)
- Did you upload the APN certificate to Firebase? (https://firebase.google.com/docs/cloud-messaging/ios/certs)
- Do you correctly use the Notification Center if you want to display notifications?
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
add a comment |
up vote
0
down vote
Seeing as your code works fine for Android, but not for iOS I would follow the differences you need to pay attention to:
- Did you initialize Firebase correctly for iOS? You might need to manually map your APN token to the Firebase token (https://firebase.google.com/docs/cloud-messaging/ios/client)
- Did you upload the APN certificate to Firebase? (https://firebase.google.com/docs/cloud-messaging/ios/certs)
- Do you correctly use the Notification Center if you want to display notifications?
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
add a comment |
up vote
0
down vote
up vote
0
down vote
Seeing as your code works fine for Android, but not for iOS I would follow the differences you need to pay attention to:
- Did you initialize Firebase correctly for iOS? You might need to manually map your APN token to the Firebase token (https://firebase.google.com/docs/cloud-messaging/ios/client)
- Did you upload the APN certificate to Firebase? (https://firebase.google.com/docs/cloud-messaging/ios/certs)
- Do you correctly use the Notification Center if you want to display notifications?
Seeing as your code works fine for Android, but not for iOS I would follow the differences you need to pay attention to:
- Did you initialize Firebase correctly for iOS? You might need to manually map your APN token to the Firebase token (https://firebase.google.com/docs/cloud-messaging/ios/client)
- Did you upload the APN certificate to Firebase? (https://firebase.google.com/docs/cloud-messaging/ios/certs)
- Do you correctly use the Notification Center if you want to display notifications?
answered Nov 7 at 12:22
Gleydar
84
84
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
add a comment |
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Suggested checks have been investigated - presumed to be configured correct. Sadly still getting false trying to add to topics using iOS tokens. Only difference I see is how the token looks between iOS and Android. Working Android token: (dIXd6ZHVyy4:APA91bEO_Xkn9pw8L8gKPRnFDZmVmN5ywyWCrS84uNo8-JwJWq167RjYT4lvhr91DTlEcAbX1k9x4ZsuZvIENBt0evax2RkPhlRdqJUYFtqczl1FuOgCPZIcp13KSFljLseFBZWqIpcB). iOS token (not working): (73FF6FC7BE399395209088B2652468C4E251DD3CDED250342FD1DA2906BF5876). Has anyone else got any suggestions or had a similar issue they managed to resolve? Thanks.
– Paul Deehan
Nov 15 at 9:17
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
Sorry I couldn't help, whenever I implemented Firebase notifications, I used native code, which worked when following the instructions... :/
– Gleydar
Nov 16 at 10:07
add a comment |
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%2f53188958%2ffirebase-notifications-subscribing-to-topics-using-ios-fcm-token-failing-all-t%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