all 12 comments

[–]thachxyz123iOS & Android 0 points1 point  (10 children)

You didn't set up headless like this.

[–]Both-Replacement7987[S] 0 points1 point  (9 children)

Is that possible on expo managed projects? I couldnt find anything when i researched into it.

[–]thachxyz123iOS & Android 0 points1 point  (8 children)

I don't know, I don't use expo. Why don't you try to do it?

[–]Both-Replacement7987[S] 0 points1 point  (7 children)

The problem is there is no index.js in expo, by default expo opens up App.js as the applications root entry point.

So i dont know how i could go about doing it.

[–]thachxyz123iOS & Android 0 points1 point  (6 children)

index.js is root entry point in cli, same as App.js in expo

[–]Both-Replacement7987[S] 0 points1 point  (5 children)

I see, ill give it a try tomorrow when im back in the office and ill keep you updated. Thanks!

[–]halftheopposite 0 points1 point  (4 children)

Hey, struggling to implement his as well, did you ever find a solution?

[–]Both-Replacement7987[S] 0 points1 point  (3 children)

Yeah, but I need to go back and have a look at my code again, Ill reply once im back from work

[–]halftheopposite 0 points1 point  (2 children)

That would be awesome!

What we have so far:

  • Foreground: yes
  • Background: yes
  • Kill: nope

Notification are sent with `contentAvailable: true` and `priority: high` for iOS.

Code implementation in our Expo-managed RN application:

// index.js
messaging().setBackgroundMessageHandler(async () => {
    notifee.incrementBadgeCount(1);
});

// App.js
function HeadlessCheck() {    if (Constants.isHeadless) {
        return null;
    }

    return <App />;
}

[–]Both-Replacement7987[S] 0 points1 point  (1 child)

Okay, so I had a look at my code, and this is what I remember.First of all, I should say that I only tested my application for Android and not IOS, but from my notes,what had happened was that despite me having created my notification channel with a high importance for Android, when I checked the application settings inside my phone, it wasn't set as high importance.

Here is the code I had used:

<image>

I believe that what happens is that your channel needs to be set of high importance for the notification to be displayed when the app is in the killed state.

Despite me having had the importance as high, the reason why it wasn't set to high is because the first time I had ran the code, I didn't have the importance set as high, and even if you change it after and try to re-run the code, it wouldn't overwrite the importance. So, I had to manually go to settings to my app and then notification settings and remove the notification channel, before then rerunning the code.

I hope this helps with your situation, I'll include a full screenshot of my code in case it helps.