I have integrated Firebase Cloud Messaging + Azure Notification Hub into a Xamarin Android application.
Registering with Notification Hub is successful and I could able to view the registration id.
Below code shows how I register with notification hub.
public override void OnTokenRefresh()
{
var refreshedToken = FirebaseInstanceId.Instance.Token;
Log.Debug(TAG, "FCM token: " + refreshedToken);
SendRegistrationToServer(refreshedToken);
}
async void SendRegistrationToServer(string token)
{
try
{
// Register with Notification Hubs
hub = new NotificationHub(AndAppConsts.Hub_Name,
AndAppConsts.DefaultListenSharedAccessSignature, MainActivity.instance);
string[] tags = Settings.SubscriptionList.Split(';');
await Task.Run(() =>
{
var regID = hub.Register(token, tags).RegistrationId;
Log.Debug(TAG, $"Successful registration of ID {regID}");
});
}
catch (Exception e)
{
}
}
When I do a test send using Azure Notification Hub, I am getting below error for the registered Id.
The Push Notification System handle for the registration is no longer valid
I have given Firebase Server Key as the API key in Azure Access policy.
I would like to know why this error occurs.