通知未到达应用程序。 (NotificationHubUnauthorizedException:未经授权)

Notifications are not arriving in the app. (NotificationHubUnauthorizedException: Unauthorized)

通知未到达应用程序。

错误:

at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <0ad2222fd7074badb5de547b1521aab0>:0 在 Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <0ad2222fd7074badb5de547b1521aab0>:0 在 WindowsAzure.Messaging.NotificationHub.Register(System.String pnsHandle,System.String[] 标签)[0x00043] in :0 在 SiagriAuth.Droid.MyFirebaseIIDService.SendRegistrationToServer (System.String token, System.String pessoaId, System.String conta) [0x00035] in D:\Projetos\SIAGRIAutorize\SiagriAuth\SiagriAuth\SiagriAuth.Droid\Services\MyFirebaseIIDService.cs:74 --- 托管 WindowsAzure.Messaging.NotificationHubUnauthorizedException 堆栈跟踪结束 --- com.microsoft.windowsazure.messaging.NotificationHubUnauthorizedException: 未经授权 在 com.microsoft.windowsazure.messaging.Connection.executeRequest(Connection.java:250) 在 com.microsoft.windowsazure.messaging.Connection.executeRequest(Connection.java:172) 在 com.microsoft.windowsazure.messaging.Connection.executeRequest(Connection.java:132) 在 com.microsoft.windowsazure.messaging.NotificationHub.refreshRegistrationInformation(NotificationHub.java:297) 在 com.microsoft.windowsazure.messaging.NotificationHub.registerInternal(NotificationHub.java:391) 在 com.microsoft.windowsazure.messaging.NotificationHub.register(NotificationHub.java:144)

报名人数:

void SendRegistrationToServer(string token, string pessoaId, string conta)
{
    try
    {
        hub = new NotificationHub(Constants.NotificationHubName, Constants.ListenConnectionString, Context);
        var tags = new List<string>();
        tags.Add($"{pessoaId}-{conta}");
        var reg = hub.Register(token, tags.ToArray()); // Error here
    }
    catch (Exception ex)
    {
        App.HandleException(ex);
    }
}

在许多论坛上,他们说这是日期和时区问题。更正了服务器和应用程序上的时间,但通知仍然没有到达,帮帮我?

Xamarin.Azure.NotificationHubs.Android 版本 0.5.0

通常,当您的设备时间与使用的时区不同时,就会发生这些授权错误。

检查包是否更新到最新版本:

Microsoft Azure 通知中心 Android Xamarin.GooglePlayServices.Base WindowsAzure.Messaging