[Bug]: status() returns STATUS_AVAILABLE while battery usage is Restricted
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee la implementación de Android enlazada en el issue, android/tsbackgroundfetch/src/main/java/com/transistorsoft/tsbackgroundfetch/BackgroundFetch.java, especialmente status(). Comprueba cómo informa Android de las restricciones en el uso en segundo plano y compáralo con las constantes de estado esperadas. La tarea se considera terminada cuando status() devuelve STATUS_DENIED si el uso en segundo plano está restringido y el comportamiento se ha verificado en Android 9 o posterior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Required Reading
- Confirmed
Plugin Version
4.4.2 (tsbackgroundfetch 4.1.1)
Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
Xiaomi 14T
Device operating-systems(s)
Android 16
React Native / Expo version
0.88.1
What happened?
status() always returns STATUS_AVAILABLE, also when the app's battery usage is Restricted, which blocks the fetch job in the background. Expected STATUS_DENIED, as on iOS when the user turns Background App Refresh off:
public static final int STATUS_DENIED = 1; // matches the JS constant
public int status() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
if (am != null && am.isBackgroundRestricted()) return STATUS_DENIED;
}
return STATUS_AVAILABLE;
}
If status() is meant to be iOS-only, a note in the docs would help.
Plugin Code and/or Config
BackgroundFetch.configure(
{
minimumFetchInterval: 15,
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true,
},
onFetch,
onTimeout
);
await BackgroundFetch.status(); // 2 while Restricted
Relevant log output
Restricted (adb shell cmd appops set <pkg> RUN_ANY_IN_BACKGROUND ignore), app in the background, adb shell am make-uid-idle <pkg>, from dumpsys jobscheduler:
JOB #u0a558/999: … com.transistorsoft.tsbackgroundfetch.FetchJobService
Satisfied constraints: DEVICE_NOT_DOZING WITHIN_QUOTA SSRU [0xb000000]
readyNotRestrictedInBg: false
STOP-P: #u0a558/999 … FetchJobService constraints
Allowed, same steps:
Satisfied constraints: FLEXIBILITY DEVICE_NOT_DOZING BACKGROUND_NOT_RESTRICTED WITHIN_QUOTA SSRU [0xb600000]
readyNotRestrictedInBg: true
D TSBackgroundFetch: - Background Fetch event received: react-native-background-fetch
- Lenguaje dominante
- Java
- Estrellas
- 1.6k
- Forks
- 194
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de transistorsoft/react-native-background-fetch
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
transistorsoft/react-native-background-fetch#582 · 2 comentarios ·
Todos los issues de transistorsoft/react-native-background-fetch
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
NationalSecurityAgency/ghidra#10220 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
RIS export splits an organization name containing “and” into multiple authorsPosiblemente ocupada @Gautam-aman la tomó hoy. Abiertostatus: needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
JabRef/jabref#17821 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
FailureContext.java rounds down thresholds in lastedAtLeast()Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día