Java Code Examples for org.altbeacon.beacon.BeaconManager#isAndroidLScanningDisabled()

The following examples show how to use org.altbeacon.beacon.BeaconManager#isAndroidLScanningDisabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsData.java    From android-beacon-library with Apache License 2.0 5 votes vote down vote up
public SettingsData collect(@NonNull Context context) {
    BeaconManager beaconManager = BeaconManager.getInstanceForApplication(context);
    mBeaconParsers = new ArrayList<>(beaconManager.getBeaconParsers());
    mRegionStatePersistenceEnabled = beaconManager.isRegionStatePersistenceEnabled();
    mAndroidLScanningDisabled = beaconManager.isAndroidLScanningDisabled();
    mRegionExitPeriod = BeaconManager.getRegionExitPeriod();
    mUseTrackingCache = RangeState.getUseTrackingCache();
    mHardwareEqualityEnforced = Beacon.getHardwareEqualityEnforced();
    return this;
}
 
Example 2
Source File: CycledLeScanner.java    From android-beacon-library with Apache License 2.0 5 votes vote down vote up
public static CycledLeScanner createScanner(Context context, long scanPeriod, long betweenScanPeriod, boolean backgroundFlag, CycledLeScanCallback cycledLeScanCallback, BluetoothCrashResolver crashResolver) {
    boolean useAndroidLScanner = false;
    boolean useAndroidOScanner = false;
    if (android.os.Build.VERSION.SDK_INT < 18) {
        LogManager.w(TAG, "Not supported prior to API 18.");
        return null;
    }

    if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        LogManager.i(TAG, "This is pre Android 5.0.  We are using old scanning APIs");
        useAndroidLScanner = false;

    }
    else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
        if (BeaconManager.isAndroidLScanningDisabled()) {
            LogManager.i(TAG, "This is Android 5.0, but L scanning is disabled. We are using old scanning APIs");
            useAndroidLScanner = false;
        } else {
            LogManager.i(TAG, "This is Android 5.0.  We are using new scanning APIs");
            useAndroidLScanner = true;
        }
    }
    else {
        LogManager.i(TAG, "Using Android O scanner");
        useAndroidOScanner = true;
    }

    if (useAndroidOScanner) {
        return new CycledLeScannerForAndroidO(context, scanPeriod, betweenScanPeriod, backgroundFlag, cycledLeScanCallback, crashResolver);
    }
    else if (useAndroidLScanner) {
        return new CycledLeScannerForLollipop(context, scanPeriod, betweenScanPeriod, backgroundFlag, cycledLeScanCallback, crashResolver);
    } else {
        return new CycledLeScannerForJellyBeanMr2(context, scanPeriod, betweenScanPeriod, backgroundFlag, cycledLeScanCallback, crashResolver);
    }
}