Device doesn't receive notifications in debug mode

When running app in debug mode on iPhone I cannot receive any notification, while the same app installed from HockeyApp receives notifications without any problem. We already checked provisioning profiles and certificates, everything's fine, also device is registered as RegisteredForRemoteNotifications is called however DidReceiveRemoteNotification isn't. I tried to send a test notification from Azure portal also tried to run app not in debug but ad-hoc doesn't work. Does anyone know what can be an issue?

public override async void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
                 {
                            // Opened by push notification.
                            if (application.ApplicationState == UIApplicationState.Background ||
                                        application.ApplicationState == UIApplicationState.Inactive)
                                {
                                    // Make userInfo readable.
                                    PushNotification notification = CrossDevice.Current.ConvertToNotification(userInfo);

                                    // Check if we want to open a specified participation.
                                    if (notification != null && notification.ParticipationId != 0)
                                    {
                                        await _formsApp.LoadParticipation(notification.ParticipationId);
                                    }
                                }

                                // Process notification so we can attach to it's received event.
                                CrossAzurePushNotifications.Platform.ProcessNotification(userInfo);

                                // No data is altered.
                                completionHandler(UIBackgroundFetchResult.NoData);
                        }

Note: we are using AzurePushNotifications plugin

Answers

  • PanayiotisZinierisPanayiotisZinieris USMember ✭✭

    I'm having the exact same issue. Did you found a solution on that?

  • MonikaHencekovaMonikaHencekova USMember ✭✭

    @PanayiotisZinieris said:
    I'm having the exact same issue. Did you found a solution on that?

    Yes we did.
    You have to create 2 different certificates and provisioning profiles one for development and one for production, also you need 2 notification hubs one sendbox for development and for production. Than all you have to do is manage switching between those 2 and if all your configuration and registration of device works fine, you should receive notifications. We currently switched from azure to app center to get rid off plug-in mentioned above because it had few bugs (don't know the current state of it)
    I personally found app center set up for notifications better than messing up with plugins and azure hubs, setting things up in app center is easier.

  • PanayiotisZinierisPanayiotisZinieris USMember ✭✭

    OK i finally found the solution thanks to you

    I had to use Sandbox in Azure Notification Hub for the testing and then change it back to Production and upload a new certificate for production

    Also in FCM for the Release version, I had to add the SHA 1 Certificate Fingerprint from the Release Keystore

    I'm still using Azure Notification Hub and I haven't encountered any bugs or errors

Sign In or Register to comment.