Système Android tué mon service quand j'ai effacer toutes les app

J'ai déjà utiliser startforeground() à mon Service, mais Android continue de tuer mon Service quand j'ai effacer toutes les applications récentes.

Voici le code de mon Service:

@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;
}

Est-il quelque chose de mal que j'ai fait avec ce code?

vous pouvez utiliser START_REDELIVER_INTENT au lieu de START_STICKY
désolé, mais mon service toujours été tué après l'utilisation.

OriginalL'auteur zamroni hamim | 2016-03-31