-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headless JS doesn't work when app is killed #22881
Comments
you cannot run anything when app is killed. |
@RittaIbrahim did you get Headless running while app in background ? |
Same issue here. I disagree with @dulmandakh that you cannot run anything. After I kill the app, then send it a push notification, I can see in logcat that the app wakes up and Firebase handles the notification. I also want to let JS handle the notification. Then the app crashes because of the following: https://stackoverflow.com/questions/46445265/android-8-0-java-lang-illegalstateexception-not-allowed-to-start-service-inten/49846410#49846410. Apparently, the background system changed in newer versions of Android and this has to be updated in RN. |
It seems like |
Headless works when the app is in the background but not when app is killed |
@RittaIbrahim Headless JS seamlessly works when the app is killed i.e even when it is not in background. I had to handle In-line reply for push notification in my android app and Headless JS was the perfect solution for it. The documentation is very neat provided by them and it doesn't. Try setting to the timeout to 0 sec or min as required by your task and that should work fine. |
The above code doesn't work. |
|
Environment
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz
Memory: 860.27 MB / 3.89 GB
Binaries:
Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338
react: "16.6.3",
react-native: "0.57.8",
Description
I'm looking for a way to run task or service when the app is killed (not in background state), I tried to use Headless JS but it's working in foreground only, then I tried the JobScheduler but it doesn't seem work when app is killed.
My task is about fetching data from server and push notification in some conditions.
Any help please.
The text was updated successfully, but these errors were encountered: