El servicio no se inicia de nuevo después de que la aplicación kill incluso utilice START_STICKY en algún dispositivo
En mi servicio, he devuelto START_STICKY
para que mi Service
reinicie nuevamente después de matar la aplicación.
Tengo prueba y funciona en el dispositivo Samsung
, Sony
, LG
, pero en Xiaomi
no funciona (el servicio no se inicia de nuevo)
@Override public int onStartCommand(Intent intent, int flags, int startId) { return START_STICKY; }
¿Cómo puedo manejar este caso. Cualquier ayuda o sugerencia sería muy apreciada?
Desde los documentos Android
- Servicio de grabación / procesamiento de llamadas! - Android
- Llamar el método de clase de actividad de la clase de servicio
- Intentando iniciar un servicio de inicio en Android
- Android - ¿Utilizando el método de un servicio en una actividad?
- AccessibilityService se destruye cuando se ejecuta uiautomator
/** * Constant to return from {@link #onStartCommand}: if this service's * process is killed while it is started (after returning from * {@link #onStartCommand}), then leave it in the started state but * don't retain this delivered intent. Later the system will try to * re-create the service. Because it is in the started state, it will * guarantee to call {@link #onStartCommand} after creating the new * service instance; if there are not any pending start commands to be * delivered to the service, it will be called with a null intent * object, so you must take care to check for this. * * <p>This mode makes sense for things that will be explicitly started * and stopped to run for arbitrary periods of time, such as a service * performing background music playback. */ public static final int START_STICKY = 1;
- Cómo mostrar el mini controlador en la parte inferior o controles de medios persistentes como spotify o Google música en la aplicación completa
- La interfaz de usuario principal se congela incluso cuando las tareas son manejadas por AsyncTask
- Llame a una clase de servicio Una vez al día cuando la aplicación se inicia en android, con menos consumo de batería
- Servicio Android-Comunicación de 2 vías
- Android cómo mantener la biblioteca nativa cuando la aplicación se detuvo
- ¿Cómo evitar que el servicio se detenga cuando onTaskRemoved es calles?
- ¿Cómo puedo enlazar este servicio en Android?
- Android startService Synchronous?
- Edición de la galería Android: el tamaño de la galería es mayor de lo esperado
- HttpURLConnection.getInputStream siempre lanza IOException en android 2.1