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?