react-native-background-timer icon indicating copy to clipboard operation
react-native-background-timer copied to clipboard

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

Open stevenixxdc opened this issue 4 years ago • 8 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.

stevenixxdc avatar Aug 10 '21 08:08 stevenixxdc

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:

https://github.com/transistorsoft/react-native-background-fetch/issues/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...

risafj avatar Aug 24 '21 11:08 risafj

@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 avatar Aug 28 '21 15:08 Kaz-z

@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).

risafj avatar Aug 29 '21 07:08 risafj

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.

Kaz-z avatar Aug 29 '21 13:08 Kaz-z

Did you guys find a solution ?

ZanaNabaz avatar Dec 02 '21 16:12 ZanaNabaz

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.

sssembler avatar Dec 03 '21 12:12 sssembler

Did anyone find a good solution for this?

erickalvesduobox avatar Feb 15 '23 17:02 erickalvesduobox

I am facing the same issue

DeveloperEstiven avatar Nov 01 '23 12:11 DeveloperEstiven