I would like to ask if someone could help with a problem which i have. I have generated the Authentication Key (.p8). Also i have set it into the firebase console under the tab "Cloud Messaging". While i successfully completed the android push notification process, i get stuck on IOS implementation. I test the APNS with the pusher app and it works just fine. So the certificate is correct. When i use the firebase console the error is "Unregistered registration token". Of course i use the token which is generated from firebase plugin and not the token from APNS. I use xamarin form for the development and the plug in is Plugin.FirebasePushNotification by Rendy Del Rosario. i follow the instructions from the github. Below is the code :
code inside the AppDelegate.cs file // Here is the code to Initialize the FirebasePushNotificationManager
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
FirebasePushNotificationManager.Initialize(options, true);
return base.FinishedLaunching(app, options);
}
Function prints the token from APN which i use to send notification from the pusher app. The generated token is valid
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
byte[] deviceTokenBytes = deviceToken.ToArray();
string deviceToken2 =
BitConverter.ToString(deviceTokenBytes).Replace("-", enter code
here"").ToUpperInvariant();
Debug.WriteLine("------> " + deviceToken2);
FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
}
inside the App.cs file Function print the token which i use to send notification from the firebase console. The generated token is invalid and produce an error "Unregistered Registration Token"
CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
{
System.Diagnostics.Debug.WriteLine($"TOKEN : "+ p.Token
};
Can anyone help me?
Thanks