Skip to content

Commit ad361d2

Browse files
docs: setBackgroundMessageHandler invocation tip in FAQ (#5657)
Tip for invoking setBackgroundMessageHandler in quit state on iOS devices. Added a new question in the FAQ section. Co-authored-by: Mike Hardy <[email protected]>
1 parent 32ddef7 commit ad361d2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/faqs-and-tips.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ Sometimes when building an in-app-message in the console, sending a test to a de
6363

6464
Sometimes, after step 3, you have to click inside a "Text color" field, but this should enable the "Test on device" option. After that you add the device Install ID, make sure to quit the app before the actual test, and then I wait for the confirmation toast to open the app up again. As long as the ID is 100% correct, the test should work as intended.
6565

66+
### On iOS, when the app is in quit state, the setBackgroundMessageHandler is never invoked even when I receive the notification. How can I fix this?
67+
68+
When the app is closed/quit, this can happen even when you are getting notifications and even when you are able to invoke the app in a headless state.
69+
70+
To fix this:
71+
72+
1. You first need to send the payload with "content-available: 1" in the `apns` section of the message payload so the app gets invoked in a headless state.
73+
2. On the `index.js` page, if the app is invoked in headless mode, instead of returning null, return a simple component that does nothing and renders nothing. Otherwise, return the actual `App` component.
74+
75+
To view the complete detail for this solution, please refer to this page: [#5656](https://github.com/invertase/react-native-firebase/issues/5656)
76+
6677
# Tips
6778

6879
- Whenever you face a strange issue (or an issue that causes build errors), there are two things you should always consider.

0 commit comments

Comments
 (0)