Пример #1
0
  @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();
  }
Пример #2
0
  @Override
  protected void onStop() {
    if (mLastCameraPosition != null) {
      saveMapLocation(mLastCameraPosition);
    }
    GoogleAnalytics.getInstance(this).reportActivityStop(this);

    super.onStop();
  }
Пример #3
0
  @Override
  protected void onResume() {
    super.onResume();
    // We'll use the starred hosts when network is offline.
    starredHostDao.open();
    starredHosts = starredHostDao.getAllBrief();

    setUpMapIfNeeded();
  }
Пример #4
0
 @Override
 protected void onStart() {
   super.onStart();
   GoogleAnalytics.getInstance(this).reportActivityStart(this);
 }
Пример #5
0
 @Override
 protected void onPause() {
   starredHostDao.close();
   super.onPause();
 }