O sistema Android interrompeu meu serviço quando limpo todos os aplicativos recentes
Eu já estou usandostartforeground()
em minhaService
, mas o Android continua matando meuService
quando eu limpo todos os aplicativos recentes.
Aqui está o código do meu serviço:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Notification notification = new NotificationCompat.Builder(this)
.setContentTitle("Text")
.setTicker("Text")
.setContentText("Text")
.setSmallIcon(R.drawable.icon)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.icon))
.build();
startForeground(100, notification);
return START_STICKY;
}
Há algo errado que eu fiz com esse código?