Tengo entendido que si quiero que un servicio se ejecute incluso si no hay nada limitado a él, primero debe iniciarse con startService (Intent i).Wait on startService before bindService
Mi pregunta es ¿QUÉ PASA SI QUIERO VINCULAR AL SERVICIO INMEDIATAMENTE DESPUÉS DE INICIARLO? ¿GARANTIZARÍA EL CÓDIGO SIGUIENTE QUE EL SERVICIO SE CREA CON STARTERvice()?
Método estático dentro de la clase de servicio:
public static void actStart(Context ctx) {
Intent i = new Intent(ctx, BGService.class);
i.setAction(ACTION_START);
ctx.startService(i);
}
La actividad de unión:
BGService.actionStart(getApplicationContext());
bindService(new Intent(this, BGService.class), serviceConnection, Context.BIND_AUTO_CREATE);
Me enfrento con el mismo problema. ¿Has encontrado una decisión? –
El servicio de enlace realmente espera a que termine el servicio de inicio – Paul