-
Hello fellows coders, I'm trying to debug this for a while. The // src/index.js
messaging().setBackgroundMessageHandler(message => {
console.log('[notification] ', message) // nothing happens
}) I've tried the following:
The payload: {
tokens: [],
notification: {
title: 'Test',
body: 'Oi oi',
},
data: { payload: '{"type": "call"}'},
android: {},
apns: {
payload: {
aps: {
'content-available': 1,
'mutable-content': 1,
sound: {
critical: true,
name: 'default',
volume: 1.0,
},
},
},
},
} Using the v14.9.3 "@react-native-firebase/app": "^14.9.3",
"@react-native-firebase/messaging": "^14.9.3", Background modes is properly set on Xcode. What am I missing here? Cheers! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
If you include a notification block, it will not trigger anything in the background, it shows the notification but you get no control |
Beta Was this translation helpful? Give feedback.
-
Hey @mikehardy, I'm gonna answer my own question hoping it will help someone else digging the same hole. In their own documentation Apple highlights it:
On top of that iOS may put your app in a "suspended state". You should see something like this in the device logs:
Checking the devices logs again, I can see the push notification did arrive but because the app is in a "suspended state" the notification alone can't wake it up. Pay attention to the
For me use case because they are critical to the product, the only solution I found is to implement PushKit. Cheers! |
Beta Was this translation helpful? Give feedback.
-
----------------------------Am also facing this issue kindly help me------------------------- ---------------Here is my App.js file code----------------------- /**
import { AppRegistry } from 'react-native'; //----------------Request Permissions for Notifications ----------------\ async function requestUserPermission() { //----------------Call when App is in kill or background state------// messaging().setBackgroundMessageHandler(async remoteMessage => { function HeadlessCheck({ isHeadless }) { // Render the app component on foreground launch AppRegistry.registerComponent(appName, () => HeadlessCheck); //---------------disable font scaling IOS---------------------- if (Text.defaultProps == null) { ---------------Here is my AppDelegate.mm file code---------------------- #import "RNFBMessagingModule.h" @implementation AppDelegate
/// This method controls whether the
-----------------Packages I am using-------------------- "react-native": "0.71.4", |
Beta Was this translation helpful? Give feedback.
-
Is there any way? It doesn't activate so I can't update the Badge |
Beta Was this translation helpful? Give feedback.
-
I am facing the same issue, never triggers in background on IOS. but the same block is working on android. IOS is receiving the notification but setBackgroundMessageHandler is not triggering. i need help |
Beta Was this translation helpful? Give feedback.
Hey @mikehardy,
I'm gonna answer my own question hoping it will help someone else digging the same hole.
In their own documentation Apple highlights it:
On top of that iOS may put your app in a "suspended state". You should see something like this in the device logs:
Checki…