Rapsssito / react-native-background-actions

React Native background service library for running background tasks forever in Android & iOS.
MIT License
818 stars 117 forks source link

Task stops working after 3 minutes on android 14 #247

Open Beckmann0o opened 1 month ago

Beckmann0o commented 1 month ago

Hi guys, I'm trying to set up a task that can be done every 30 seconds, the idea is to run constantly. The problem is that in versions prior to Android 14 it works fine, but in Android 14 it works for 3 minutes and the application stops working. I think it may be because of the declared service type android:foregroundServiceType="shortService", maybe if I change the service type the task could run for longer, did anyone have the same problem?

Thank you very much!

chowdhury-abhishek commented 1 month ago

I am also facing the same issue, I have changed to foregroundServiceType, it's working for the first time but not everytime. Did you found any solutions @Beckmann0o ?

carozo commented 1 month ago

same issue here 😕

devtyty commented 1 month ago

Hi guys, I'm trying to set up a task that can be done every 30 seconds, the idea is to run constantly. The problem is that in versions prior to Android 14 it works fine, but in Android 14 it works for 3 minutes and the application stops working. I think it may be because of the declared service type android:foregroundServiceType="shortService", maybe if I change the service type the task could run for longer, did anyone have the same problem?

Thank you very much!

Can you show your adb logs?

I think you can try change your fouregroundServiceType to syncData to take longer task

Beckmann0o commented 2 weeks ago

También tengo el mismo problema. Cambié a closeupServiceType y funciona la primera vez, pero no siempre. ¿Encontraste alguna solución?@Beckmann0o?

Hello bro, I was able to make it run continuously by adding foreground type in the Android manifest, the problem is that when the screen is turned off for several hours the OS kills the service. Did you have any progress? I leave how to configure the manifest: <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:foregroundServiceType="connectedDevice|dataSync|location">

Beckmann0o commented 2 weeks ago

Hola chicos, estoy intentando configurar una tarea que se pueda realizar cada 30 segundos, la idea es que se ejecute constantemente. El problema es que en versiones anteriores a Android 14 funciona bien, pero en Android 14 funciona durante 3 minutos y la aplicación deja de funcionar. Creo que puede ser por el tipo de servicio declarado android:foregroundServiceType="shortService", tal vez si cambio el tipo de servicio la tarea podría ejecutarse por más tiempo, ¿alguien tuvo el mismo problema? ¡Muchas gracias!

¿Puedes mostrar tus registros adb?

Creo que puedes intentar cambiar tu fouregroundServiceType a syncData para que tarde más en realizar una tarea.

Hello, I already have it configured as follows: <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:foregroundServiceType="connectedDevice|dataSync|location">

It works fine as long as the screen does not remain off for several hours, at which point the OS kills my service.

Beckmann0o commented 2 weeks ago

También tengo el mismo problema. Cambié a closeServiceType y funciona la primera vez, pero no siempre. ¿Encontraste alguna solución?@Beckmann0o?

Hello, I changed the service type in the Android manifest and got it to work continuously but when the screen is off for several hours the OS kills the service, I am trying to solve that problem. I'll give you my current configuration in the manifest for the type of service.

<service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:foregroundServiceType="connectedDevice|dataSync|location">