Created
March 4, 2014 04:04
-
-
Save anirudh24seven/9340099 to your computer and use it in GitHub Desktop.
WordPress for Android - onCreate() in WordPress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@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