I am currently using React Native Firebase from "https://rnfirebase.io/". I have registered a foreground handler, and I confirmed that messages are received correctly while the app is in the foreground. However, after the app goes into the background and receives one message, the previously registered foreground handler gets disconnected and no longer functions.
As a temporary solution, I re-register the foreground handler within the background handler, and this allows it to work again when the app returns to the foreground. However, when calling UI-related APIs (such as alert), I receive a warning message saying "Tried to show an alert while not attached to an Activity." I suspect this happens because the app is running in headless mode when the handler is registered in the background, and thus UI processing is not possible.
I am wondering if there is a standard or recommended way to handle this issue, particularly with managing handlers in this scenario. Any guidance would be greatly appreciated.
Ignite version
9.8.0
Additional info
System
platform darwin
arch arm64
cpu 10 cores Apple M1 Pro
directory ccnlab-client /Users/choi_sanghoon/dev/project4/ccnlab-client
JavaScript (and globally-installed packages)
node 20.16.0 /Users/choi_sanghoon/.nvm/versions/node/v20.16.0/bin/node
npm 10.8.1 /Users/choi_sanghoon/.nvm/versions/node/v20.16.0/bin/npm
corepack 0.28.2
eas-cli 10.2.2
firebase-tools 13.15.1
npm 10.8.1
protoc-gen-js 3.21.2
yarn - not installed
pnpm - not installed
bun - not installed
expo 51.0.32 managed
Describe the bug
I am currently using React Native Firebase from "https://rnfirebase.io/". I have registered a foreground handler, and I confirmed that messages are received correctly while the app is in the foreground. However, after the app goes into the background and receives one message, the previously registered foreground handler gets disconnected and no longer functions.
As a temporary solution, I re-register the foreground handler within the background handler, and this allows it to work again when the app returns to the foreground. However, when calling UI-related APIs (such as alert), I receive a warning message saying "Tried to show an alert while not attached to an Activity." I suspect this happens because the app is running in headless mode when the handler is registered in the background, and thus UI processing is not possible.
I am wondering if there is a standard or recommended way to handle this issue, particularly with managing handlers in this scenario. Any guidance would be greatly appreciated.
Ignite version
9.8.0
Additional info
System platform darwin arch arm64 cpu 10 cores Apple M1 Pro directory ccnlab-client /Users/choi_sanghoon/dev/project4/ccnlab-client
JavaScript (and globally-installed packages) node 20.16.0 /Users/choi_sanghoon/.nvm/versions/node/v20.16.0/bin/node npm 10.8.1 /Users/choi_sanghoon/.nvm/versions/node/v20.16.0/bin/npm corepack 0.28.2 eas-cli 10.2.2 firebase-tools 13.15.1 npm 10.8.1 protoc-gen-js 3.21.2 yarn - not installed pnpm - not installed bun - not installed expo 51.0.32 managed
Ignite ignite-cli 9.9.1 /Users/choi_sanghoon/.npm/_npx/e31027f3785124a8/node_modules/.bin/ignite ignite src build /Users/choi_sanghoon/.npm/_npx/e31027f3785124a8/node_modules/ignite-cli/build
Android java 17.0.12 /usr/bin/java android home - /Users/choi_sanghoon/Library/Android/sdk
iOS xcode 15.4 cocoapods 1.15.2 /Users/choi_sanghoon/.rvm/gems/ruby-2.7.8/bin/pod
Tools git git version 2.39.3 (Apple Git-146) /usr/bin/git