【问题标题】:OneSignal notification - update notification title on receive and before displaying it (android)OneSignal 通知 - 在接收和显示之前更新通知标题 (android)
【发布时间】:2016-09-26 18:32:20
【问题描述】:

当用户收到通知时,我想更改/更新标题或正文。在向用户显示通知之前。我的猜测是在NotificationExtenderService.onNotificationProcessingOneSignal.NotificationReceivedHandler 内部实现这个 但不知道 API 文档也没有帮助。

【问题讨论】:

    标签: android push-notification onesignal


    【解决方案1】:

    解决了。您可以在 onNotificationProcessing 事件中更改提醒值。

    protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
        OverrideSettings overrideSettings = new OverrideSettings();
        overrideSettings.extender = new NotificationCompat.Extender() {
           @Override
           public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
               builder.setContentText....
               builder.setContentTitle...
           }
        }
    }
    

    【讨论】:

      【解决方案2】:

      您不能简单地通过构建器方法 setContentText() 覆盖。 请在 OneSignal 存储库中查看有关问题的答案。

      https://github.com/OneSignal/OneSignal-Android-SDK/issues/717

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-08-22
        • 1970-01-01
        • 2021-12-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多