studio siempre mantener ejemplo aplicacion abierta android service

android - siempre - El servicio no se inicia de nuevo después de la eliminación de la aplicación, incluso utiliza START_STICKY en algún dispositivo



mantener aplicacion siempre abierta android studio (1)

Algunos dispositivos como Xiaomi y Vivo tienen un permiso adicional llamado "inicio automático" que permite que el servicio de su aplicación se reinicie automáticamente después de ser asesinado. Puede encontrarlo en permisos adicionales en Xiaomi, supongo.

En mi Servicio, he devuelto START_STICKY para que mi Service reinicie nuevamente después de que se cierre la aplicación.
Tengo la 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?
De los documentos de Android

/** * 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;