private ApptentiveInternal(Application application, String apptentiveKey, String apptentiveSignature, String serverUrl, boolean shouldEncryptStorage) { if (StringUtils.isNullOrEmpty(apptentiveKey)) { throw new IllegalArgumentException("Apptentive Key is null or empty"); } if (StringUtils.isNullOrEmpty(apptentiveSignature)) { throw new IllegalArgumentException("Apptentive Signature is null or empty"); } this.apptentiveKey = apptentiveKey; this.apptentiveSignature = apptentiveSignature; this.serverUrl = serverUrl; SecurityManager.init(application.getApplicationContext(), shouldEncryptStorage); appContext = application.getApplicationContext(); globalSharedPrefs = application.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); apptentiveHttpClient = new ApptentiveHttpClient(apptentiveKey, apptentiveSignature, getEndpointBase(globalSharedPrefs)); conversationManager = new ConversationManager(appContext, Util.getInternalDir(appContext, CONVERSATIONS_DIR, true), SecurityManager.getMasterKey()); appRelease = AppReleaseManager.generateCurrentAppRelease(application, this); taskManager = new ApptentiveTaskManager(appContext, apptentiveHttpClient, SecurityManager.getMasterKey()); ApptentiveNotificationCenter.defaultCenter() .addObserver(NOTIFICATION_CONVERSATION_STATE_DID_CHANGE, this) .addObserver(NOTIFICATION_CONVERSATION_WILL_LOGOUT, this) .addObserver(NOTIFICATION_AUTHENTICATION_FAILED, this) .addObserver(NOTIFICATION_INTERACTION_MANIFEST_FETCHED, this) .addObserver(NOTIFICATION_APP_ENTERED_FOREGROUND, this) .addObserver(NOTIFICATION_APP_ENTERED_BACKGROUND, this) .addObserver(NOTIFICATION_CONFIGURATION_FETCH_DID_FINISH, this); }