-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
- CLI: 7.1.2
- Cross-platform modules: 7.1.0
- Android Runtime: 7.0.1
- iOS Runtime: 7.1.0
- XCode Version: 12.3
Describe the bug
I am using Native Script Timer for implementing idle timeout in my project. It works fine when application is running in foreground mode. However when application is in background and phone is not being used timer does not fires.
Android behaviour:
Timer does not fires after the elapsed time when application is in background.
iOS behaviour:
I know timers does not fire in iOS when application is in background. But in this case timer is not firing when application comes to foreground after elapsed time.
To Reproduce
- Create a new timer in native script project scheduled to fire after 30 minutes
- Put application in background and do not use the phone during that time. Phone should be locked and not on charging mode
- Launch the application after 30 minutes.
- You will notice that timer had not fired.
Expected behavior
In Android timer should have fired after 30 minutes.
In iOS timer should have fired instantly when application comes to foreground anytime after 30 minutes.
Additional context
- In steps to reproduce if you continue using other applications on the phone while this application is in background, then timer will fire as expected.
- It works as expected while debugging and on simulator/emulator.
- I tried scheduling timer with a native iOS project and it was working as expected which makes me believe that there is something at native script side.