public boolean isHideBranding(Context context) { try { if (!isNull(KEY_HIDE_BRANDING)) { return getBoolean(KEY_HIDE_BRANDING); } } catch (JSONException e) { logException(e); } try { ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); Bundle metaData = ai.metaData; return metaData.getBoolean(Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING, Constants.CONFIG_DEFAULT_HIDE_BRANDING); } catch (Exception e) { ApptentiveLog.w(CONVERSATION, e, "Unexpected error while reading %s manifest setting.", Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING); logException(e); } return Constants.CONFIG_DEFAULT_HIDE_BRANDING; }
public int getMessageCenterFgPoll() { try { JSONObject messageCenter = getMessageCenter(); if (messageCenter != null) { if (!messageCenter.isNull(KEY_MESSAGE_CENTER_FG_POLL)) { return messageCenter.getInt(KEY_MESSAGE_CENTER_FG_POLL); } } } catch (JSONException e) { logException(e); } return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_FG_POLL_SECONDS; }
public int getMessageCenterBgPoll() { try { JSONObject messageCenter = getMessageCenter(); if (messageCenter != null) { if (!messageCenter.isNull(KEY_MESSAGE_CENTER_BG_POLL)) { return messageCenter.getInt(KEY_MESSAGE_CENTER_BG_POLL); } } } catch (JSONException e) { logException(e); } return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_BG_POLL_SECONDS; }
public long getConfigurationCacheExpirationMillis() { try { if (!isNull(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS)) { return getLong(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS); } } catch (JSONException e) { logException(e); } return Constants.CONFIG_DEFAULT_APP_CONFIG_EXPIRATION_MILLIS; }
private JSONObject getMessageCenter() { try { if (!isNull(KEY_MESSAGE_CENTER)) { return getJSONObject(KEY_MESSAGE_CENTER); } } catch (JSONException e) { logException(e); } return null; }
public void setConfigurationCacheExpirationMillis(long configurationCacheExpirationMillis) { try { put(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS, configurationCacheExpirationMillis); } catch (JSONException e) { ApptentiveLog.w(CONVERSATION, "Error adding %s to Configuration.", KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS); logException(e); } }
private boolean getBoolean(String key, boolean defaultValue) { try { return optBoolean(key, defaultValue); } catch (Exception e) { ApptentiveLog.e(e, "Exception while getting boolean key '%s'", key); logException(e); return defaultValue; } }
public static Configuration load(SharedPreferences prefs) { String json = prefs.getString(Constants.PREF_KEY_APP_CONFIG_JSON, null); try { if (json != null) { return new Configuration(json); } } catch (JSONException e) { ApptentiveLog.e(e, "Error loading Configuration from SharedPreferences."); logException(e); } return new Configuration(); }
public String getAppDisplayName() { try { if (!isNull(KEY_APP_DISPLAY_NAME)) { return getString(KEY_APP_DISPLAY_NAME); } } catch (JSONException e) { logException(e); } return ApptentiveInternal.getInstance().getDefaultAppDisplayName(); }