El sistema Android eliminó mi servicio cuando borro todas las aplicaciones recientes
Ya estoy usandostartforeground()
en miService
, pero Android sigue matando a miService
cuando borro todas las aplicaciones recientes.
Aquí está el código de mi servicio:
@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;
}
¿Hay algo mal que hice con este código?