@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); if (!initView()) { finish(); return; } // Google analytics tracker ((WSAndroidApplication) getApplication()) .getTracker(WSAndroidApplication.TrackerName.APP_TRACKER); PreferenceManager.getDefaultSharedPreferences(this) .registerOnSharedPreferenceChangeListener(this); mDistanceUnit = PreferenceManager.getDefaultSharedPreferences(this).getString("distance_unit", "km"); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); setUpMapIfNeeded(); }
@Override protected void onStop() { if (mLastCameraPosition != null) { saveMapLocation(mLastCameraPosition); } GoogleAnalytics.getInstance(this).reportActivityStop(this); super.onStop(); }
@Override protected void onResume() { super.onResume(); // We'll use the starred hosts when network is offline. starredHostDao.open(); starredHosts = starredHostDao.getAllBrief(); setUpMapIfNeeded(); }
@Override protected void onStart() { super.onStart(); GoogleAnalytics.getInstance(this).reportActivityStart(this); }
@Override protected void onPause() { starredHostDao.close(); super.onPause(); }