On Android, Connecthings’ SDK allows you to easily manage the Bluetooth scanning process for your app.
With alerts, high scanning frequency is recommended to ensure quick beacon detection. Our SDK launches a foreground scan every second.
With the scanning process for notifications, however, you must find a right balance between rapid beacon detection, and battery impact limitation.
To do this, AdTag and our SDK feature a Background Scanning Strategy parameter. You can manage this setting directly in the platform, by selecting and configuring one of the following two scanning strategies: Scan when display is turned ON, or Regular scanning
Regular scanning Strategy
This is the default configuration in our SDK:
- When the application is active/running in the foreground, the SDK does an active Bluetooth scan, with a high scanning period
- When the application is running in the background or is closed, the SDK does a smart Bluetooth scan, with a lower scanning period
You can play with two background scanning parameters to manage battery consumption:
- The Scanning Duration: the length of the SDK scanning periods
- The Scanning Interval: the time lapse between two SDK Bluetooth scans
To optimize beacon detection and the notification process, we recommend setting the Scanning Interval to 15-30 seconds and the Scanning Duration to 10-30 seconds.
With this algorithm, when the application is running in the background, the SDK is actively scanning about 50% of the time. Constant scanning is not appropriate as it would drain users' battery.
The final values that you choose depend on your app, and the type of beacon interactions you want to implement.
By default, our Default configuration comes with the following background scanning values:
- Scanning Interval: 12'
- Scanning Duration: 12'
"Scan when display is turned ON" Strategy
This configuration allows you to optimize beacon scanning when the application is running in the background, by distinguishing three app states:
When the device’s screen is turned on, the SDK launches actively scans for nearby beacons, for a limited, configurable period of time (unless a beacon is detected).
When the device’s screen is turned on, and one or several beacons are detected, the SDK launches an intensive scan until no additional beacons are detected.
When the device’s screen is turned off, the SDK waits a longer period of time before launching a new scan for nearby beacons.
By default, this scanning strategy is configured as follows:
- Scanning Duration: 12'
- Scanning Interval: 10 min
- Intensive Scanning Duration: 20'
As a result, an application that uses this configuration will:
- Rapidly detect beacons every time the phone's screen is activated
- Rapidly detect exits from beacon regions if the phone is already inside an area with beacons
- Optimize scanning (and the phone's battery) when the phone's screen is inactive.
The following diagram gives an overview of this scanning strategy’s lifecycle.
Which Background Scanning Strategy should you choose?
If you are working with a network that is spread across a larger area - for instance, all transit stops across a city -, then our Regular scanning configuration may be your best choice, to ensure high notification visibility (even if the user’s screen is OFF) and user engagement.
If you are working with a network of beacons that is concentrated in a specific area, our Scan when display is turned ON is great:
- Lower beacon scanning frequency, and minimal battery consumption, when your users are in a location with few or no beacons
- High scanning, and therefore rapid beacon detection & interactions, as soon as they enter an area with high beacon coverage
Configuring your Background Scanning Strategy
You can configure your Background Scanning Strategy directly in AdTag, by navigating to the Android tab of the Application Management section.