Timer stops on android after sometime running in background
Using BackgroundTimer.setInterval in the app it's working fine while the app in the foreground. When the app state changes from foreground to background it works fine there for a while as well but after few minutes like 15 to 20 it stops. Also while changing the app state from background to foreground app killed/refreshed(crashes) as well.
any help will be appreciated. Thank you
I'm having the same problem. When the app is in the background, after like 8 minutes the timer stops working and when I bring it back to the foreground it reloads.
I am facing the exact same issue
same issue,
i am also facing same issue , any solution pls
i am also facing same issue on android on iOS its working fine
@huzaifa-umer @Amar-RN Did you guys found the solution, I am also having the same issue , and for IOS , the timer stops after 30s , are you guys also facing this issue of timer stopping after 30s in IOS or not ?
pls tell me how to fix it
On Wed, 4 Aug 2021 at 12:54, huzaifa-umer @.***> wrote:
i am also facing same issue on android on iOS its working fine
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/337#issuecomment-892429299, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATU7BUBBKNQ6AAOT3M74QBTT3DTJ7ANCNFSM47N4F45Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
@huzaifa-umer @Amar-RN Did you guys found the solution, I am also having the same issue , and for IOS , the timer stops after 30s , are you guys also facing this issue of timer stopping after 30s in IOS or not ?
You have to on background mode capability in Xcode and enable Audio Airplay option to run audio in background
https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos/enabling_background_audio
same issue on Android - when the app is in the background, after 8 minutes the timer stops working and the app is killed
Hello, When in the Background, The timer stops & the app crashes exactly 10 minutes after putting it in the background (after minimizing), Got any solution? or workaround for this issue?
Same issue on iOS. Curious if anyone found a solution or workaround? Thanks!
Looks like iOS has gotten more aggressive with killing background tasks and hence this library doesn't work so well anymore. See https://rossbulat.medium.com/react-native-background-task-management-in-ios-d0f05ae53cc5 for more details.
I have a same issue on Android. API > 29 React-native: 0.66.2
Same issue here, any solution?
I've resolved this issue
On Sun, Feb 18, 2024 at 8:03 PM Arthur Oliveira @.***> wrote:
Same issue here, any solution?
— Reply to this email directly, view it on GitHub https://github.com/ocetnik/react-native-background-timer/issues/337#issuecomment-1951400937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT3NYX6ZBJLU4EONFIXFZN3YUI67VAVCNFSM47N4F452U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJVGE2DAMBZGM3Q . You are receiving this because you commented.Message ID: @.***>
I've resolved this issue … On Sun, Feb 18, 2024 at 8:03 PM Arthur Oliveira @.> wrote: Same issue here, any solution? — Reply to this email directly, view it on GitHub <#337 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT3NYX6ZBJLU4EONFIXFZN3YUI67VAVCNFSM47N4F452U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJVGE2DAMBZGM3Q . You are receiving this because you commented.Message ID: @.>
Can you post your solution please
Any updates?
On Android, this is due to the use of PostDelayed(), It's cancelled after some time in the background or if the main thread is destroyed.
AlarmManager could be used to avoid this, but there are some disadvantages:
- It may cause greater battery consumption depending on the frequency.
- Need to ask user to grant
SCHEDULE_EXACT_ALARMpermission.
WorkManager could also be used, but does not guarantee that the task will be executed at the specified time.