Overview
The Mapp Intelligence Android SDK leverages WorkManager to schedule and send cached tracking data (requests) at periodic intervals, as defined by the Config.requestInterval. WorkManager ensures that these requests are executed, even if your app is terminated. It also helps conserve battery life while improving overall performance.
You can customize WorkManager constraints based on your specific needs, such as limiting execution to when the device is connected to a network or conserving battery power.
Scheduling behavior
The Mapp Intelligence Android SDK uses Android’s WorkManager API to send cached tracking requests in the background.
WorkManager execution timing is controlled by the Android operating system. The configured request interval defines a minimum interval only and does not guarantee exact execution timing.
Please note:
The minimum supported interval is 15 minutes
Requests may be sent later, depending on system conditions
Execution may be delayed due to battery optimizations, Doze mode, or background execution limits
WorkManager prioritizes reliable delivery over precise scheduling, ensuring that requests are eventually sent, even if the app is terminated.
Example Configuration
The following example shows how to configure WorkManager constraints within your application:
class SampleApplication : Application() {
override fun onCreate() {
super .onCreate()
val constraints = Constraints.Builder()
.setRequiresBatteryNotLow( true )
.setRequiredNetworkType(NetworkType.CONNECTED).build()
val webtrekkConfigurations =
WebtrekkConfiguration.Builder(listOf( "111111111111111" ), "https://your-trackdomain.com" )
.workManagerConstraints(constraints = constraints)
.build()
Webtrekk.getInstance().init( this , webtrekkConfigurations)
}
}public class SampleApplication extends Application() {
@Override
public void onCreate(){
super .onCreate();
Constraints constraints = new Constraints.Builder()
.setRequiresCharging( true )
.setRequiresBatteryNotLow( true )
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
List<String> trackIds = new ArrayList<>();
trackIds.add( "111111111111111" );
WebtrekkConfiguration webtrekkConfiguration = new WebtrekkConfiguration.Builder(trackIds, "https://your-trackdomain.com" )
.setWorkManagerConstraints(constraints)
.build();
Webtrekk.getInstance().init( this , webtrekkConfiguration);
}
}