【问题标题】:Notifications are not arriving in the app. (NotificationHubUnauthorizedException: Unauthorized)通知未到达应用程序。 (NotificationHubUnauthorizedException:未授权)
【发布时间】:2020-01-24 14:26:31
【问题描述】:

应用程序未收到通知。

错误:

在 Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod(Java.Interop.JniObjectReference 实例,Java.Interop.JniMethodInfo 方法,Java.Interop.JniArgumentValue* args)[0x00069] in :0 在 Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* 参数) [0x0002a] in :0 在 WindowsAzure.Messaging.NotificationHub.Register (System.String pnsHandle, System.String[] tags) [0x00043] in :0 在 D:\Projetos\SIAGRIAutorize\SiagriAuth\SiagriAuth\SiagriAuth.Droid\Services\MyFirebaseIIDService.cs:74 中的 SiagriAuth.Droid.MyFirebaseIIDService.SendRegistrationToServer(System.String 令牌,System.String pessoaId,System.String conta)[0x00035] --- 托管 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);
    }
}

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

Xamarin.Azure.NotificationHubs.Android 0.5.0 版

【问题讨论】:

    标签: c# xamarin push-notification android-notifications


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-06
      • 1970-01-01
      • 2018-02-27
      • 2012-07-21
      • 2019-05-31
      • 2020-08-13
      • 2017-07-10
      相关资源
      最近更新 更多