0

我正在尝试将 onesignal 集成到我正在使用 Xamarin SDK 开发的应用程序中。使用 android 和 ios 设备一切正常。

使用 Hauwei 设备时,我遇到的问题是“HandleNotificationReceived”回调未被调用,而是“HandleNotificationOpened”回调被调用。通知无论如何都会到达,因此建议正确配置华为推送套件。

我还尝试扩展“Com.OneSignal.Android.NotificationExtenderService”类,但情况是一样的:使用 android 时调用它,而使用华为时则没有。

            OneSignal.Current.StartInit(OneSignalData.AppId)
            .Settings(new Dictionary<string, bool>() {
                { IOSSettings.kOSSettingsKeyAutoPrompt, false },
                { IOSSettings.kOSSettingsKeyInAppLaunchURL, false }, })
            .InFocusDisplaying(OSInFocusDisplayOption.Notification)
            .HandleNotificationOpened((result) =>
            {
                on_notification_action(result);
            })
            .HandleNotificationReceived((notification) =>
            {
                on_notification_received(notification);
            })
            .HandleInAppMessageClicked((action) =>
            {
                // Example IAM click handling for IAM elements
                Debug.WriteLine("HandledInAppMessageClicked: {0}", action.clickName);
            })               
            .EndInit();

安装的 nuGet 包是:Com.OneSignal 3.10.2 和 nventive.Com.OneSignal 3.2.13 我正在华为 p40PRO EMUI 10.1.0 Andorid 10 上测试该应用程序。

省电应用权限设置也应该没问题。

会是什么?提前致谢

4

1 回答 1

0

根据 OneSignal 文档,您应该先集成华为 Xamarin SDK,然后将 OneSignal 添加到您在华为设备上的应用程序中。您还可以集成Xamarin Push Kit

于 2020-11-02T12:22:42.420 回答