Executing actions when notification is received with background/killed state app (iOS)? #4326
Replies: 5 comments 11 replies
-
@mikehardy maybe? 😅 |
Beta Was this translation helpful? Give feedback.
-
For precise discussion I/we really need to see the exact JSON you post, and the exact steps you took to interact with the phone to get it to the state you describe. I find the "background/kill state" description to be imprecise as I recognize those as two different states in the iOS application state progression |
Beta Was this translation helpful? Give feedback.
-
Hmm.. I thought I have given quite some detail information. Apparently it's not. Well, the JSON payload is exactly what I have received. I'm using the "background/kill state" here because I understand both the states are handle by the method For steps, I don't have much to tell actually. Very straight forward... [Background state]
|
Beta Was this translation helpful? Give feedback.
-
Quit != kill. Those are distinct states and the table should really have a 4th column called "Force Close / Kill" where the user has swiped the app away. It's a distinct state from Quit and in Kill / Force Close nothing works. So I am specific with my words yes - pursuing wakes-up-on-messages solutions for "kill" state is fruitless I see you aren't swiping the app away though (thanks for providing the steps) so you are likely in the actual "Quit" state, so there is potential. I don't want to discuss an FCM pushed from the portal. I want to see the JSON, use a curl script and POST JSON to the REST API endpoint provided by FCM, that's required in order to have a precise discussion and control your testing. Of course do not post the API keys or device token, but the JSON is critical to inspect |
Beta Was this translation helpful? Give feedback.
-
Thanks for being specific with the wording, perhaps let me add on another steps example. Example 1: [Background state]
Example 2: [Kill state]
Same situation for example 1 and example 2
I'm not aware about whats the difference using Portal / curl script to push the notification. In fact, I have never try with curl script. Anyway, here's my first try... Script
Since my portal is sending data-only message, I suppose I should replace JSON
|
Beta Was this translation helpful? Give feedback.
-
Anyone.. quick check with people who's working/worked with push notification. My backend is sending Data-Only message.
Sample payload received from server
For now, my method
setBackgroundMessageHandler
is not called when banner (notification) kicks in when app is in Background/Kill state. This happened because my payload does not containcontentAvailable: true
I guess, since it's stated here 😖Anyway, my app will show the banner notification (in both Background and Killed state) still but no code is running behind the scene when app receive banner notification. Meaning if the user decides to open my app without tapping the banner, I'm unable to store the notification content hence user will never see the notification content in app.
Unless he opens the app via the banner (notification), my app gets the notification content. Hence I'm able to do certain processing behind (storing content, append into my notification list)..
My questions:
How can we wake the app and does certain processing (store content, etc) as soon as notification banner is received?
How can we update Badge number when app is in Background/Kill stated? (I planned to do it via the "behind process" as well when notification is received. But for now, I don't get notify until user taps the banner)
Of course, here goes my version
"@react-native-firebase/messaging": "^7.8.4",
Beta Was this translation helpful? Give feedback.
All reactions