@Override
 public void onBeaconServiceConnected() {
   super.onBeaconServiceConnected();
   BeaconTrackServiceHelper.setBackgroundScanPeriod(this, 300);
   BeaconTrackServiceHelper.setForegroundScanPeriod(this, 300);
   BeaconTrackServiceHelper.addRegion(
       this, new Region("global", BeaconDataStore.ESTIMOTE_UUID, null, null));
   BeaconTrackServiceHelper.rescheduleMonitoring(this);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setup_beacon);

    tvHint = (TextView) findViewById(R.id.tvHint);
    tvStatus = (TextView) findViewById(R.id.tvStatus);
    ibBeacon = (ImageButton) findViewById(R.id.ibBeacon);

    if (!BeaconUtils.checkBluetoothAvaliability()) {
      BeaconUtils.turnOnBluetoothIfNotAvaliable(this);
    }
    BeaconTrackServiceHelper.restartBeaconTrackSerivce(getApplication());
  }
 @Override
 public void onBeaconMonitoringEnter(ParcelableRegion region) {
   super.onBeaconMonitoringEnter(region);
   BeaconTrackServiceHelper.rescheduleRanging(this);
 }
 @Override
 protected void onDestroy() {
   BeaconTrackServiceHelper.stopBeaconTrackSerivce(getApplication());
   super.onDestroy();
 }