Comments (8)
Hey @erotundo 👋 , yup, that is what happens here, when the app is inactive or not on focus all kind of animations are suspended to keep the battery. The thing you can do in this case is to save the remaining time and the current time (like in UNIX timestamp) when the app goes in the background, when the app comes back active, you check again the current time and subtract the time when the app went inactive so you know how much time passed. Then from the remaining time you subtract the elapsed time and make the timer start from that position so it looks like it was running in the background. Does it make sense?
from react-countdown-circle-timer.
Hi @vydimitrov thanks for your quick answer, lot of things happen with the background (not with your library works very well) in iOS the suspension on the background activities (30 seconds) generates a problem in all ways so i think the same capture when start the counter and when turn on the screen capture this new moment and update the remaining time or trigger the complete event if it's done. I use a solution to keep the screen awake with the keep-awake package and with that all works (obviously hahaha). Thanks again for your answer i think right it's something we cannot solve but with the screen awake or capture the time and restart the countdown with the new remaining time it's enough. Kind Regards!
from react-countdown-circle-timer.
I seem to have the same problem with a React app running on an Android phone via PWA. Which leads me to believe this is not mobile or iOS specific :)
from react-countdown-circle-timer.
Hey @sorensenmarius, did you manage to find a workaround for this on Android?
from react-countdown-circle-timer.
Hey @vydimitrov, I have not found a workaround while using this component. However, I implemented it myself without this component and solved the problem by saving the timer start time and calculating the time left from that rather than having a background process counting continously.
from react-countdown-circle-timer.
Ahhh, cool, it is good you found a solution for you :) If I can ask, what was the problem adding the same logic for saving the time and use it later with the countdown timer?
from react-countdown-circle-timer.
I am sure that would work as well, as it is basically the same approach I ended up using ;)
from react-countdown-circle-timer.
Cool, I just wanted to know if there is an easy way to do it since already a few people ask about a solution for this problem.
from react-countdown-circle-timer.
Related Issues (20)
- Typescript error: type expected HOT 3
- CountdownCircleTimer background color ? HOT 5
- Is there a way to check easily if the countdown timer is in Delay state HOT 2
- react-countdown-circle-timer on reload counter restart issue HOT 1
- onComplete always fire when reset duration after onComplete 1st bug HOT 1
- Inaccurate progress when used as a progress bar HOT 2
- animatedColor status | Bump CountdownCircleTimer from 2.5.4 to 3.0.9? HOT 1
- Cannot run countdown in a test (vitest) HOT 2
- updateInterval not working for 1 second HOT 7
- Cannot find name remainingTime HOT 2
- On Ios the counter remainingTime becames NaN HOT 7
- Error HOT 2
- Render Error: Cannot convert undefined value to object HOT 2
- Type error: using strings inside "colors" prop HOT 2
- Kill and restart the app timer restart HOT 2
- Can not stop when complete
- Start at prop HOT 3
- Error: Timer causes apk to crash HOT 3
- Slow down Rotation speed HOT 2
- Issue with colors being calculated and displayed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-countdown-circle-timer.