Skip to content

Instantly share code, notes, and snippets.

@anirudh24seven
Created March 4, 2014 04:04
Show Gist options
  • Save anirudh24seven/9340099 to your computer and use it in GitHub Desktop.
Save anirudh24seven/9340099 to your computer and use it in GitHub Desktop.
WordPress for Android - onCreate() in WordPress.java
...
@Override
public void onCreate() {
versionName = getVersionName();
initWpDb();
wpStatsDB = new WordPressStatsDB(this);
mContext = this;
// Volley networking setup
requestQueue = Volley.newRequestQueue(this, getHttpClientStack());
imageLoader = new ImageLoader(requestQueue, getBitmapCache());
VolleyLog.setTag(TAG);
// http://stackoverflow.com/a/17035814
imageLoader.setBatchedResponseDelay(0);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
if (settings.getInt("wp_pref_last_activity", -1) >= 0) {
shouldRestoreSelectedActivity = true;
}
registerForCloudMessaging(this);
// Uncomment this line if you want to test the app locking feature
AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
AppLockManager.getInstance().getCurrentAppLock().setDisabledActivities(
new String[]{"org.wordpress.android.ui.ShareIntentReceiverActivity"});
}
WPMobileStatsUtil.initialize();
WPMobileStatsUtil.trackEventForWPCom(WPMobileStatsUtil.StatsEventAppOpened);
super.onCreate();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
PushNotificationsBackendMonitor pnBackendMponitor = new PushNotificationsBackendMonitor();
registerComponentCallbacks(pnBackendMponitor);
registerActivityLifecycleCallbacks(pnBackendMponitor);
}
//Enable log recording on beta build
if (NotificationUtils.getAppPushNotificationsName().equals("org.wordpress.android.beta.build")) {
AppLog.enableRecording(true);
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment