Fix bug causing in-progress uploads to be marked as failed

This commit is contained in:
YuviPanda 2013-02-18 16:27:25 +05:30
parent 2df1b1b02f
commit 6e2c3341b7

View file

@ -148,10 +148,11 @@ public class UploadService extends HandlerService<Contribution> {
}
private boolean freshStart = true;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if(intent.getAction() == ACTION_START_SERVICE) {
if(intent.getAction() == ACTION_START_SERVICE && freshStart) {
ContentValues failedValues = new ContentValues();
failedValues.put(Contribution.Table.COLUMN_STATE, Contribution.STATE_FAILED);
@ -161,6 +162,8 @@ public class UploadService extends HandlerService<Contribution> {
new String[]{ String.valueOf(Contribution.STATE_QUEUED), String.valueOf(Contribution.STATE_IN_PROGRESS) }
);
Log.d("Commons", "Set " + updated + " uploads to failed");
Log.d("Commons", "Flags is" + flags + " id is" + startId);
freshStart = false;
}
return START_REDELIVER_INTENT;
}