一信号静默通知

时间:2019-12-05 10:24:43

标签: java android onesignal silent-notification

当我收到来自One信号的任何静默通知时,我需要刷新或重新加载活动,我如何才能实现此功能,任何人都可以帮助我。这是我所有的代码示例。

public class Silent_NotificationExtender extends NotificationExtenderService {


    @Override
    protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) {
        // Read properties from result.

        OverrideSettings overrideSettings = new OverrideSettings();
        overrideSettings.extender = new NotificationCompat.Extender() {
            @Override
            public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {
                // Sets the background notification color to Green on Android 5.0+ devices.
                return builder.setColor(new BigInteger("FF00FF00", 16).intValue());
            }
        };

        OSNotificationDisplayedResult displayedResult = displayNotification(overrideSettings);
        Log.d("OneSignalExample", "Notification displayed with id: " + displayedResult.androidNotificationId);

        // Return true to stop the notification from displaying.
        // Here i need to refresh the current activity

        return true;
    }
}

0 个答案:

没有答案