We have an Azure Notification Hub set up, with APNS Configured in Production Mode, using our Production APNS Certificate.
We register our test devices (using TestFlight / Production build, and certificate) to APNS, and then to ANH with a tag dealer-1
. We can send notifications using our production certificate and registered Device ID with success when using APNS directly, however, when we use 'Test Send' we get a 'Successful send' to 1 device (or however many we have registered). The notification is not received. If we then run 'Test Send' again, the are 0 devices to send to.
In the logs, we see 'APNS Errors' per device, per test send. I cannot see any way to view what the errors actually are though so this is an absolutely useless metric.
I have ran through all the troubleshooting steps and confirmed many times that everything is setup in 'Production'.
Having reviewed other questions, the answers have been along the lines of:
- .. registering a sandbox certificate and then changing it to production. Unfortunately we created this hub from scratch as Production in an attempt to work around that potential issue.
- .. registering sandbox devices (and thus tokens) against the production certificate. Unfortunately I have controlled this closely and ensured that we are only registering TestFlight builds (thus Production) against the ANH.
- .. uploading the wrong certificate. I have confirmed with the Push Notification Tester, as above, that the certificate is correct (thumbprint confirmed, re-uploaded, etc) and works to send to the devices via Production APNS endpoint.
The resource name is: eight-technology/react-push-notification-hub
In-app registration process is as follows:
- Device registers for push notifications
Registration event is handled in iOS Project (AppDelegate event)..
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) { //base.RegisteredForRemoteNotifications(application, deviceToken); App.ConfigurePushNotifications(deviceToken.ToString()); }
ConfigurePushNotifications is in the XF Shared Project..
public static void ConfigurePushNotifications(string deviceToken) { var azureComm = DependencyService.Get<Interop.IAzureCommunication>(); azureComm.RegisterForPushTags( "sb://eight-technology.servicebus.windows.net/", ".. token ..", "react-push-notification-hub", deviceToken, StateManager.SelectedNodes.Select(m => "dealer-" + m).ToArray()); }
The implementation is pretty much as per the sample code provided (contained in iOS project)
public class AzureCommunication : DealerwebReact.Interop.IAzureCommunication { public void RegisterForPushTags(string url, string key, string hubName, string deviceToken, string[] tags) { var cs = SBConnectionString.CreateListenAccess(new NSUrl(url), key); var hub = new SBNotificationHub(cs, hubName); hub.RegisterNativeAsync(deviceToken, new NSSet(tags), err => { if (err != null) Console.WriteLine("Error: " + err.Description); else Console.WriteLine("Success"); }); } }