Service redeliver intent strange behavior?
<p>I'm using a Service with <code>START_REDELIVER_INTENT</code> and with that Service I want to upload to a server a video and some metadata that comes along with the video.</p>

<p>As far as I can tell I need to use <code>START_REDELIVER_INTENT</code> and not <code>START_STICKY</code> since the first will try and get the data from the intent again and I need those data.</p>

<p>What I have noticed to happen is that it uploads the video with its metadata to my server correctly but it will reupload it again randomly the next 1-2 days.</p>

<p>I have not tested this behavior a lot but it has already happened 4-5 times. Am i doing something wrong ? Should I have added something to my <code>Service</code> it to mark it as correct when it successfully uploads my data so it won't redeliver ? </p>

<p>My code :</p>

<pre><code>@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    MyApplication.get(this).applicationComponent().inject(this);

    getIntentValues(intent);

    buildNotification();

    return START_REDELIVER_INTENT;
}

private void getIntentValues(Intent intent) {
// Here I get some strings from the intent ... 
}

private void buildNotification() {
    Notification.Builder builder = new Notification.Builder(this);
    builder.setSmallIcon(R.drawable.ic_action_search);
    builder.setContentTitle("Upload");
    builder.setContentText("Thank you for uploading!");
    builder.setPriority(Notification.PRIORITY_MIN);

    Notification notification = builder.build();

    // Start the Service in the Foreground
    startForeground(NOTIFICATION_ID, notification);

    Thread taskThread = new Thread(new UploadVideoTask());
    taskThread.start();

}
</code></pre>