@Override public void onCreate() { super.onCreate(); long startDate = SystemClock.elapsedRealtime(); mContext = this; ProfilingUtils.start("App Startup"); // Enable log recording AppLog.enableRecording(true); AppLog.i(T.UTILS, "WordPress.onCreate"); if (!PackageUtils.isDebugBuild()) { Fabric.with(this, new Crashlytics()); } versionName = PackageUtils.getVersionName(this); initWpDb(); enableHttpResponseCache(mContext); // EventBus setup EventBus.TAG = "WordPress-EVENT"; EventBus.builder() .logNoSubscriberMessages(false) .sendNoSubscriberEvent(false) .throwSubscriberException(true) .installDefaultEventBus(); EventBus.getDefault().register(this); RestClientUtils.setUserAgent(getUserAgent()); // Volley networking setup setupVolleyQueue(); AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this); if (AppLockManager.getInstance().isAppLockFeatureEnabled()) { AppLockManager.getInstance() .getCurrentAppLock() .setDisabledActivities( new String[] {"org.wordpress.android.ui.ShareIntentReceiverActivity"}); } HelpshiftHelper.init(this); ApplicationLifecycleMonitor applicationLifecycleMonitor = new ApplicationLifecycleMonitor(); registerComponentCallbacks(applicationLifecycleMonitor); registerActivityLifecycleCallbacks(applicationLifecycleMonitor); initAnalytics(SystemClock.elapsedRealtime() - startDate); }
public static String getUserAgent() { if (mUserAgent == null) { mUserAgent = USER_AGENT_APPNAME + "/" + PackageUtils.getVersionName(getContext()) + " (Android " + Build.VERSION.RELEASE + "; " + Locale.getDefault().toString() + "; " + Build.MANUFACTURER + " " + Build.MODEL + "/" + Build.PRODUCT + ")"; } return mUserAgent; }