ocetnik / react-native-background-timer

Emit event periodically (even when app is in the background)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work in release mode - does not trigger when device is 'off'

stevenixxdc opened this issue · comments

Any ideas on a fix? works fine when connected and debugging but as soon as I publish a release build it fails to do what it should.

This is on android.

I have the same issue, on both iOS and Android 🙁
I looked at other similar libraries like react-native-background-fetch, and then saw that a very similar issue has been reported there too:

transistorsoft/react-native-background-fetch#353

Background task is not triggered on real devices or deployments. Only on debugging mode.

Since it's happening on multiple libraries, now I'm concerned that it could be an underlying React Native issue...

commented

@risafj Did you manage to find a solution to this? I've found that bringing the app to the foreground triggers the timer...which is not good given its a 'background' process :)

@Kaz-z

I've found that bringing the app to the foreground triggers the timer...which is not good given its a 'background' process :)

Agreed, this is not ideal 😕

I haven't found a solution. I think I'll try to work around the issue by not using background timer (e.g. Use AsyncStorage to save a timestamp, periodically check whether to execute my function based on that timestamp).

commented

I'm trying to find a solution. If I crack it then i'll share :).

Equally if you manage to get something working it would be great to see your progress.

Did you guys find a solution ?

I actually did get a working solution - we basically made sure to disable power saving on the app in Android and it then worked as I wanted. App stays active in the background - connects to my BLE device every X and does its thing uploading data from the device to my web api.

commented

Did anyone find a good solution for this?

I am facing the same issue