@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UmengUpdateAgent.setUpdateOnlyWifi(false); UmengUpdateAgent.update(this); setContentView(R.layout.activity_main); PushManager.getInstance().initialize(this.getApplicationContext()); if (!Check.isNotFirstLoc(this)) { PreferencesUtils.putBooleanToSPMap(MainActivity.this, PreferencesUtils.Keys.IS_LOC, true); mLocationClient = new LocationClient(this.getApplicationContext()); mMyLocationListener = new MyLocationListener(); mLocationClient.registerLocationListener(mMyLocationListener); initLoc(); } Intent intent = new Intent(this, CacheService.class); startService(intent); initData(); findViewById(); initUI(); setListener(); if (!Check.isNotFirst(this)) { startThread(); } }
@Override protected void onDestroy() { super.onDestroy(); if (mLocationClient != null && mLocationClient.isStarted()) { mLocationClient.stop(); } }
@Override public void onAttachFragment(Fragment fragment) { try { if (fragment instanceof SignDayable) { mSingDay = (SignDayable) fragment; } } catch (Exception e) { throw new ClassCastException(this.toString() + " must implementOnMainListener"); } super.onAttachFragment(fragment); }
@Override protected void onPause() { super.onPause(); mIsExit = true; }