use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class UploadServerContactsTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mApplication = (MainApplication) Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
mApplication.onCreate();
mDb = mApplication.getDatabase();
mDb.removeUserData();
mEngineTester = new EngineTestFramework(this);
mEng = new DummyContactSyncEngine(mEngineTester);
mProcessor = new UploadServerContactProcessorTest(mEng, mApplication.getDatabase());
mEng.setProcessor(mProcessor);
mEngineTester.setEngine(mEng);
mState = State.IDLE;
NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
mBulkContactTest = false;
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class NetworkAgent method onConnectionStateChanged.
/**
* Contains the main logic that determines the agent state for network
* access
*/
private void onConnectionStateChanged() {
if (mContext != null) {
MainApplication app = (MainApplication) ((RemoteService) mContext).getApplication();
if ((app.getInternetAvail() == InternetAvail.MANUAL_CONNECT)) {
LogUtils.logV("NetworkAgent.onConnectionStateChanged()" + " Internet allowed only in manual mode");
sDisconnectReason = AgentDisconnectReason.DATA_SETTING_SET_TO_MANUAL_CONNECTION;
setNewState(AgentState.DISCONNECTED);
return;
}
}
if (!mNetworkWorking) {
LogUtils.logV("NetworkAgent.onConnectionStateChanged() Network is not working");
sDisconnectReason = AgentDisconnectReason.NO_WORKING_NETWORK;
setNewState(AgentState.DISCONNECTED);
return;
}
if (mIsRoaming && !mDataRoaming && !mWifiNetworkAvailable) {
LogUtils.logV("NetworkAgent.onConnectionStateChanged() " + "Connect while roaming not allowed");
sDisconnectReason = AgentDisconnectReason.DATA_ROAMING_DISABLED;
setNewState(AgentState.DISCONNECTED);
return;
}
if (mIsInBackground && !mBackgroundData) {
LogUtils.logV("NetworkAgent.onConnectionStateChanged() Background connection not allowed");
sDisconnectReason = AgentDisconnectReason.BACKGROUND_CONNECTION_DISABLED;
setNewState(AgentState.DISCONNECTED);
return;
}
if (!mInternetConnected) {
LogUtils.logV("NetworkAgent.onConnectionStateChanged() No internet connection");
sDisconnectReason = AgentDisconnectReason.NO_INTERNET_CONNECTION;
// If 2g call is started, notify contact sync engine to pause.
if (mNetworkInfo != null && VOICE_CALL_STARTED_2G_STRING.equals(mNetworkInfo.getReason())) {
EngineManager.getInstance().getContactSyncEngine().pauseSync();
}
setNewState(AgentState.DISCONNECTED);
return;
}
// If 2g voice call is finished, set resume state
if (mNetworkInfo != null && VOICE_CALL_ENDED_2G_STRING.equals(mNetworkInfo.getReason())) {
mIsResumeSync = true;
}
if (mWifiNetworkAvailable) {
LogUtils.logV("NetworkAgent.onConnectionStateChanged() WIFI connected");
} else {
LogUtils.logV("NetworkAgent.onConnectionStateChanged() Cellular connected");
}
LogUtils.logV("NetworkAgent.onConnectionStateChanged() Connection available");
setNewState(AgentState.CONNECTED);
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class EngineManager method createLoginEngine.
/**
* Create instance of LoginEngine.
*/
private synchronized void createLoginEngine() {
final MainApplication app = (MainApplication) mService.getApplication();
mLoginEngine = new LoginEngine(mService, mUiEventCallback, app.getDatabase());
addEngine(mLoginEngine);
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class EngineManager method createGroupsEngine.
private synchronized void createGroupsEngine() {
final MainApplication app = (MainApplication) mService.getApplication();
mGroupsEngine = new GroupsEngine(mService, mUiEventCallback, app.getDatabase());
addEngine(mGroupsEngine);
}
use of com.vodafone360.people.MainApplication in project 360-Engine-for-Android by 360.
the class EngineManager method createActivitiesEngine.
/**
* Create instance of ActivitiesEngine.
*/
private synchronized void createActivitiesEngine() {
final MainApplication app = (MainApplication) mService.getApplication();
mActivitiesEngine = new ActivitiesEngine(mService, mUiEventCallback, app.getDatabase());
getLoginEngine().addListener(mActivitiesEngine);
addEngine(mActivitiesEngine);
}
Aggregations