use of com.letscooee.retrofit.DeviceAuthService in project cooee-android-sdk by letscooee.
the class CooeeFactory method init.
public static synchronized void init(Context context) {
if (initialized) {
return;
}
appInfo = AppInfo.getInstance(context);
deviceInfo = DeviceInfo.getInstance(context);
manifestReader = ManifestReader.getInstance(context);
sentryHelper = new SentryHelper(context, appInfo, manifestReader);
sentryHelper.init();
// Sentry should be initialized first
ITransaction transaction = Sentry.startTransaction("CooeeFactory.init()", "task");
baseHTTPService = new BaseHTTPService(context);
// This is required in PendingTaskService (ultimately). TODO make this a strong dependency
deviceAuthService = new DeviceAuthService(context, sentryHelper, manifestReader);
deviceAuthService.populateUserDataFromStorage();
pendingTaskService = new PendingTaskService(context, sentryHelper);
runtimeData = RuntimeData.getInstance(context);
sessionManager = SessionManager.getInstance(context);
safeHTTPService = new SafeHTTPService(context, pendingTaskService, sessionManager, runtimeData);
transaction.finish();
initialized = true;
}
use of com.letscooee.retrofit.DeviceAuthService in project cooee-android-sdk by letscooee.
the class PendingTaskJob method onStartJob.
@Override
public boolean onStartJob(JobParameters params) {
jobParameters = params;
Context context = getApplicationContext();
Log.v(Constants.TAG, "PendingTaskJob running");
DeviceAuthService deviceAuthService = CooeeFactory.getDeviceAuthService();
if (!deviceAuthService.hasToken()) {
Log.d(Constants.TAG, "Abort PendingTaskJob. Do not have the SDK token");
// Job is finished
return false;
}
List<PendingTask> taskList = CooeeDatabase.getInstance(context).pendingTaskDAO().fetchPending();
// As job was running on main thread so all the network call were getting break
CooeeExecutors.getInstance().singleThreadExecutor().execute(() -> CooeeFactory.getPendingTaskService().processTasks(taskList, this));
return true;
}
Aggregations