Commit a8941f28 authored by narinder Rana's avatar narinder Rana
Browse files

intent put extra bundle value File ObserverService to ObserverService

parent fe90bc08
Pipeline #132995 failed with stage
in 7 seconds
......@@ -11,12 +11,14 @@ package foundation.e.drive.models;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
/**
* @author Vincent Bourgmayer
* Describe a file state which will be Synchronized (= Synced) or which has already been synced one times
*/
public class SyncedFileState implements Parcelable {
public class SyncedFileState implements Parcelable, Serializable {
protected SyncedFileState(){}; //@ToRemove. Test Only. It's to allow to make a mock SyncedFileState Class in test.
......
......@@ -5,6 +5,7 @@ import android.app.Service;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.FileObserver;
......@@ -130,28 +131,34 @@ public class FileObserverService extends Service {
super.onPostExecute(s);
// Log.d("onPostExecute", "...ObserverService Intent...post Execute " );
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Log.e("onPostExecute", "...ObserverService Intent..." );
// Do something after 20s = 20000ms
try {
Log.e("TAG", "=========================================");
Log.e("TAG", "File Observer to Observer services.....");
Intent observersServiceIntent = new Intent(getApplicationContext(), foundation.e.drive.services.ObserverService.class);
observersServiceIntent.putExtra("isFileObserverService", true);
observersServiceIntent.putExtra("fileObserverObject", CommonUtils.convertToBytes(new foundation.e.drive.models.FileObserver(files, syncedFileStatesList)));
startService(observersServiceIntent);
}catch (Exception exception){
exception.printStackTrace();
}
observerFlag=-1;
}
}, 20000);
try {
Log.e("TAG", "=========================================");
Log.e("TAG", "File Observer to Observer services.....");
Intent observersServiceIntent = new Intent(getApplicationContext(), foundation.e.drive.services.ObserverService.class);
Bundle mBundle = new Bundle();
mBundle.putBoolean("isFileObserverService", true);
mBundle.putByteArray("fileObserverObject", CommonUtils.convertToBytes(new foundation.e.drive.models.FileObserver(files, syncedFileStatesList)));
observersServiceIntent.putExtras(mBundle);
startService(observersServiceIntent);
}catch (Exception exception){
exception.printStackTrace();
}
observerFlag=-1;
// final Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// // Log.e("onPostExecute", "...ObserverService Intent..." );
// // Do something after 20s = 20000ms
//
//
//
//
//
// }
// }, 20000);
}
......
......@@ -91,8 +91,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene
isFileObserverService = bundle.getBoolean("isFileObserverService");
fileObserverObject = (foundation.e.drive.models.FileObserver)CommonUtils.convertFromBytes(bundle.getByteArray("fileObserverObject"));
}
}catch (Exception ex){
ex.printStackTrace();
}
......@@ -255,7 +253,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
}
} else {
if(isFileObserverService){
Log.e("TAG", "isFileObserverService................"+isFileObserverService);
handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList());
}else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment