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

manage flag scheduler and fileObserver into ConnectivityReceiver

parent 11680887
Pipeline #134260 failed with stage
in 6 seconds
......@@ -5,10 +5,14 @@ import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import java.io.IOException;
import foundation.e.drive.services.FileObserverService;
import foundation.e.drive.services.InitializerService;
public class ConnectivityReceiver
extends BroadcastReceiver {
......@@ -47,10 +51,18 @@ public class ConnectivityReceiver
//connectivityReceiverListener.onNetworkConnectionChanged(isConnected);
//}
if(isConnected){
Intent observersServiceIntent = new Intent(context, foundation.e.drive.services.ObserverService.class);
if(InitializerService.schedulerFlag){
//if Scheduler flag
context.startService(observersServiceIntent);
}else if(InitializerService.fileObserverFlag) {
//
Bundle mBundle = new Bundle();
mBundle.putBoolean("isFileObserverService", true);
observersServiceIntent.putExtras(mBundle);
context.startService(observersServiceIntent);
}
//else fileObserver Flag
}
}
......
......@@ -63,7 +63,8 @@ public class InitializerService extends Service
private ConnectivityReceiver connectivityReceiver;
public static List<File> files=new ArrayList<>();
// public static List<File> fileObserver=new ArrayList<>();
public static boolean schedulerFlag=false;
public static boolean fileObserverFlag=false;
@Override
public void onCreate() {
......
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