Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

await SBNotificationHub.UnregisterAllAsync hangs indefinitely

$
0
0

No matter what I try, I cannot get the sample code (any version of it) for Push Notification using Azure Hubs to work.

I have tried writing the code like this:

this.Hub = new SBNotificationHub(Constants.ListenConnectionString, Constants.HubName);
this.Hub.UnregisterAll(deviceToken, (error) =>
{
    if (error != null)
    {
         System.Diagnostics.Debug.WriteLine("Error calling unregister: {0}", error.ToString());
         return;
    }
    NSSet tags = null;
    this.Hub.RegisterNative(deviceToken, tags, (e) =>
    {
         if (e != null)
         {
               System.Diagnostics.Debug.WriteLine("Error calling unregister: {0}", e.ToString());
         }
    })
});

and in this case, the UnregisterAll callback is never called, so device registration never occurs.

I have tried moving the RegisterNative call outside the callback so that I know it gets called, but it doesn't seem to do anything.

And I have tried the Async versions of the calls like this:

await this.Hub.UnregisterAllAsync(deviceToken);
await this.Hub.RegisterNativeAsync(deviceToken, null);

and in this case, the call to UnregsiterAllAsync just hangs forever.

I am using Visual Studio 2019 16.6.5 on Windows 10, XCode 11.6, Catalina 10.15.6 and am running the code on an iPhone 8 Plus with iOS 13.5.1.

I already wasted several days trying to get FCM to work, and none of that code worked either, so i was hoping switching to Azure and APN would make life easier...apparently that was a rather naive point of view. It seems getting push notifications to work with Xamarin and iOS is a REALLY REALY REALY hard thing to do.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>