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

BackgroundTimer stops when app goes to background in Huawei devices

Open BSThisarasinghe opened this issue 4 years ago • 1 comments

Hi, I am using this backgroud timer. It works perfectly in other devices. Timer works well in background and foreground as well. But, when it comes to huawei phones, timer stops in background. It works well in foreground. When I minimize the app or turn off the display, timer stops.

`let interval = BackgroundTimer.setInterval(async function () {
        if (that.state.timeLeft > 0) {
            await that.setState({ timeLeft: that.state.timeLeft - 1 }, function () {
                if (this.state.timeLeft === 0) {
                    BackgroundTimer.clearInterval(interval);
                    that.resetWizard();
                }
            });
        } else {
            BackgroundTimer.clearInterval(interval);
            that.resetWizard();
        }
    }, 60000);`

How can I make this work for huawei as well? Please help.

BSThisarasinghe avatar Jul 14 '21 07:07 BSThisarasinghe

me too

freekingg avatar Jul 26 '22 03:07 freekingg