Search in sources :

Example 1 with SettingsData

use of org.altbeacon.beacon.service.SettingsData in project android-beacon-library by AltBeacon.

the class BeaconManager method applyChangesToServices.

@TargetApi(18)
private void applyChangesToServices(int type, Region region) throws RemoteException {
    if (!isAnyConsumerBound()) {
        LogManager.w(TAG, "The BeaconManager is not bound to the service.  Call beaconManager.bind(BeaconConsumer consumer) and wait for a callback to onBeaconServiceConnect()");
        return;
    }
    if (mIntentScanStrategyCoordinator != null) {
        mIntentScanStrategyCoordinator.applySettings();
        return;
    }
    if (mScheduledScanJobsEnabled) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            ScanJobScheduler.getInstance().applySettingsToScheduledJob(mContext, this);
        }
        return;
    }
    Message msg = Message.obtain(null, type, 0, 0);
    if (type == BeaconService.MSG_SET_SCAN_PERIODS) {
        msg.setData(new StartRMData(this.getScanPeriod(), this.getBetweenScanPeriod(), this.mBackgroundMode).toBundle());
    } else if (type == BeaconService.MSG_SYNC_SETTINGS) {
        msg.setData(new SettingsData().collect(mContext).toBundle());
    } else {
        msg.setData(new StartRMData(region, callbackPackageName(), getScanPeriod(), getBetweenScanPeriod(), mBackgroundMode).toBundle());
    }
    serviceMessenger.send(msg);
}
Also used : SettingsData(org.altbeacon.beacon.service.SettingsData) Message(android.os.Message) StartRMData(org.altbeacon.beacon.service.StartRMData) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1 Message (android.os.Message)1 SettingsData (org.altbeacon.beacon.service.SettingsData)1 StartRMData (org.altbeacon.beacon.service.StartRMData)1