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

to manage OperationManagerService

parent ab9e75ce
Pipeline #147952 passed with stage
in 1 minute and 22 seconds
......@@ -131,12 +131,20 @@ public class ObserverService extends Service implements OnRemoteOperationListene
//Check this service isn't already working
if (isWorking) {
Log.w(TAG, "ObserverService is already working");
return super.onStartCommand(intent, flags, startId);
getApplicationContext().stopService(new Intent(getApplicationContext(), ObserverService.class));
// return super.onStartCommand(intent, flags, startId);
startService(new Intent(this, ObserverService.class));
}
//check OperationManagerService isn't working
if (prefs.getBoolean(AppConstants.KEY_OMS_IS_WORKING, false)) {
Log.w(TAG, "OperationManagerService is still performing some operation");
getApplicationContext().stopService(new Intent(getApplicationContext(), OperationManagerService.class));
if (operationsForIntent != null && !operationsForIntent.isEmpty()) {
startOperationManagerService();
}
}
//Check a minimum delay has been respected between two start.
......@@ -338,13 +346,15 @@ public class ObserverService extends Service implements OnRemoteOperationListene
//After everything has been scanned. Send Intent to OperationmanagerService with data in bundle
if (operationsForIntent != null && !operationsForIntent.isEmpty()) {
Intent OMSIntent = new Intent(this, OperationManagerService.class);
for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
}
// Intent OMSIntent = new Intent(this, OperationManagerService.class);
// for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
// OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
// }
//
// OMSIntent.putExtra("account", mAccount);
// startService(OMSIntent);
OMSIntent.putExtra("account", mAccount);
startService(OMSIntent);
startOperationManagerService();
......@@ -380,6 +390,16 @@ public class ObserverService extends Service implements OnRemoteOperationListene
return result;
}
private void startOperationManagerService() {
Intent OMSIntent = new Intent(this, OperationManagerService.class);
for (Map.Entry<Integer, Parcelable> entry : operationsForIntent.entrySet()) {
OMSIntent.putExtra(entry.getKey() + "", entry.getValue());
}
OMSIntent.putExtra("account", mAccount);
startService(OMSIntent);
}
/* methods related to Server Scanning */
/**
......
Markdown is supported
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