private void startTrackingService() {
    if (!DateTimes.isSameDay(mDate, Calendar.getInstance())) {
      mDate = Calendar.getInstance();

      TextView txtDate = (TextView) findViewById(R.id.txtDate);
      txtDate.setText(DateTimes.dateFormat().format(mDate));

      GPSHelper.loadTrackings(mDate);
      updateList();
    }

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(PresenceManagerUtil.CHANGE_STATUS);
    getApplicationContext().registerReceiver(mIspReceiver, intentFilter);

    mPresenceManager.startPresence();
    for (String p : mLocationManager.getAllProviders()) {
      LocationListener ll = new MyLocationListener();
      mLocationManager.requestLocationUpdates(
          p, 60000, // 通知のための最小時間間隔(ミリ秒)
          30, // 通知のための最小距離間隔(メートル)
          ll);
      locationListeners.add(ll);
    }
    buttonVisible(true);
  }
 private void stopTrackingService() {
   getApplicationContext().unregisterReceiver(mIspReceiver);
   mPresenceManager.stopPresence();
   for (LocationListener ll : locationListeners) {
     mLocationManager.removeUpdates(ll);
   }
   locationListeners.clear();
   buttonVisible(false);
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mDate = Calendar.getInstance();

    findViewById(R.id.btnStart).setOnClickListener(this);
    findViewById(R.id.btnStop).setOnClickListener(this);
    TextView txtDate = (TextView) findViewById(R.id.txtDate);
    txtDate.setText(DateTimes.dateFormat().format(mDate));
    txtDate.setOnClickListener(this);

    buttonVisible(false);

    mHandler = new Handler(getMainLooper());

    mGeocoder = new Geocoder(this, Locale.getDefault());

    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    //		// Criteriaオブジェクトを生成
    //		Criteria criteria = new Criteria();
    //		criteria.setAccuracy(Criteria.ACCURACY_FINE);
    //		criteria.setPowerRequirement(Criteria.POWER_LOW);
    //		locationProvider = mLocationManager.getBestProvider(criteria, true);
    //		log.debug("Location Provider: " + locationProvider);
    //		setTitle(getTitle() + " - " + locationProvider);

    mPresenceManager = PresenceManager.getInstance(getApplicationContext());

    MyAdapter adapter = new MyAdapter(this, GPSHelper.getTrackings());

    ListView listView = (ListView) findViewById(R.id.listTracking);
    listView.setAdapter(adapter);

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // ListView listView = (ListView)parent;

            // TrackingData item = (TrackingData)listView.getItemAtPosition(position);

            if (position % 2 == 0) {
              startActivity(new Intent(MainActivity.this, MapLineActivity.class));
            } else {
              startActivity(new Intent(MainActivity.this, MapCircleActivity.class));
            }
          }
        });

    mHandler.postDelayed(
        new Runnable() {
          @Override
          public void run() {
            GPSHelper.loadTrackings(mDate);
            updateList();
          }
        },
        100);
  }