Xamarin iOS RegisteredForRemoteNotifications intermittently not called Android works 100% of the time RRS feed

  • Question

  • I have spent "weeks" on and off on this issue. I've parked the iOS notification requirement and moved on to others. But now, I need to solve this problem.

    I started with a Microsoft azure-notification-hub example...quite a few other samples/documents reference this sample code.

    Send and receive push notifications with Azure Notification Hubs and Xamarin.Forms (posted 11/27/2019)

    ...and following the provided instructions exactly, I was initially able to use the Dispatcher project to send Azure Push Notifications to both iOS and Android.

    After a week of enhancing this sample code with Location change detection and middle-tier calls, the iOS project just stopped working for no apparent reason. I created a new WinForms dispatcher project of which manages Azure Notification Hub registrations (view and delete only) and I could see both iOS and Android Azure device registrations. This replaced the command-line Dispatcher that came with the above example.

    Occasionally, the iOS (actual iPhone) would begin receiving notifications. However, most of the time, the iPhone would not receive notifications and, quite a few times, would not even register with Azure. The Azure portal mirrored these findings.

    ** I have not had any problems "at all" with Android Firebase notifications being routed through Azure Notification Hub **

    Eventually, I went back to the Microsoft supplied Azure Notification Hub example mentioned above to re-baseline. Even that known-good, previously working example exhibited the same iOS issues (occasionally not registering with Azure, and more than often not receiving notifications when registered).

    I pulled an all night-er last night in an attempt to resolve this issue or at least establish a pattern in which this issue occurs, and even more importantly, how to reset my baseline such that it works. For a while the below process seemed to work about 80% of the time...

    1) Manually delete all Azure Notification Hub registrations using my modified Dispatcher WinForms app.
    2) Remove the app from both the physical iPhone and the Android emulated devices.
    3) Stop Visual Studio 2019
    4) !!! Turn off the iPhone and wait for at least 20 minutes !!!
    5) Turn on the iPhone
    6) Start Visual Studio 2019 and load the baseline project mentioned above.
    7) Execute with iOS, Android, and Dispatcher projects in DEBUG mode.

    With this process the iPhone will register and begin receiving Azure Push Notifications ... usually 20 ~ 30 seconds behind the immediate Android notification receipt. This process does not always work...and it takes a lot of time.

    Now, the iOS device (physical iPhone) will register about 40% of the time and no longer receives push notifications.

    On a whim, I created a second Azure notification hub and experienced the exact same iOS problems.

    Surely, I cannot be the only person on the planet having these problems.

    My team is depending on my getting solid push notifications to work on both iOS and Android.

    Any help would be greatly appreciated, just a shove in the right direction. My sanity depends on it.

    Many thanks,

    MacBook Air macOS Catalina 10.15.4
    Xcode versions 11.4.1 (11E503a)

    PC Windows 10 Pro version 1909 OS build 18363.778
    Visual Studio 2019 version 16.5.4
    Microsoft.Azure.NotificationHubs version 3.3.0

    Friday, April 17, 2020 3:25 PM

All replies

  • I am still having this problem.  Worked great for a few days and then suddenly today, I am dead in the water. 

    Had to fall back to a Microsoft provided sample (NotificationHubSample) in order to be certain.  And, yes, Azure/APNs notification registration is not occurring (Android through the same hub is working great).

    It is hard to believe no one has ever experienced this problem.

    Thursday, April 30, 2020 9:03 PM