public void startScanning(final BeaconServiceConnection serviceConnection){
  final Cursor cursor=mDatabaseHelper.getAllRegions();
  while (cursor.moveToNext()) {
    final UUID uuid=UUID.fromString(cursor.getString(2));
    final int major=cursor.getInt(3);
    final int minor=cursor.getInt(4);
    final int event=cursor.getInt(6);
    serviceConnection.startRangingBeaconsInRegion(BeaconsFragment.BEACON_COMPANY_ID,uuid,major,minor,this);
    if (event == BeaconContract.EVENT_IN_RANGE || event == BeaconContract.EVENT_OUT_OF_RANGE)     serviceConnection.startMonitoringForRegion(BeaconsFragment.BEACON_COMPANY_ID,uuid,major,minor,this);
  }
}

public void startScanning ( final BeaconServiceConnection serviceConnection ) { final Cursor cursor = mDatabaseHelper . getAllRegions ( ) ; while ( cursor . moveToNext ( ) ) { final UUID uuid = UUID . fromString ( cursor . getString ( 2 ) ) ; final int major = cursor . getInt ( 3 ) ; final int minor = cursor . getInt ( 4 ) ; final int event = cursor . getInt ( 6 ) ; serviceConnection . startRangingBeaconsInRegion ( BeaconsFragment . BEACON_COMPANY_ID , uuid , major , minor , this ) ; if ( event == BeaconContract . EVENT_IN_RANGE || event == BeaconContract . EVENT_OUT_OF_RANGE ) serviceConnection . startMonitoringForRegion ( BeaconsFragment . BEACON_COMPANY_ID , uuid , major , minor , this ) ; } }
registers for monitoring and ranging events for all regions in the database .
