1

When sending push via onesignal to a react-native app, if I include data field in notification body it takes almost 26 seconds to reach the device but without data field it reaches within 1-2 seconds only. What can be the cause? I tried sending from node, python and Go backends.

This is the body I'm sending,

// Takes 1-2 seconds to reach
const notificationBody: any = {
    headings: { en: "Heading" },
    contents: { en: "Message"},
    include_player_ids: playerIds,
    priority: 10,
  };

// Takes 26-30 seconds to reach
const notificationBodyWithData: any = {
    headings: { en: "Heading with data" },
    contents: { en: "Message"},
    content_available: true,
    data: data || {},
    include_player_ids: playerIds,
    priority: 10,
};

I tried searching in the documentation of onesignal as well as in git issues, but couldn't find anything related to this.

1 Answer 1

0

Sorry for late answer. I got some help from official OneSignal Discord channel. Actually I was actually handling data only notifications on the native side (android and iOS) for video/audio calling purposes and I found out that I wasn't calling the complete() method on OneSignal object after processing the notification there on the native side itself. As mentioned in the OneSignal react-native docs

// Complete with null means don't show a notification.
notificationReceivedEvent.complete(notification);

That is what the issue was. It was affecting the normal notifications due to this, but now It's working fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.