Flushing Events Periodically
Detailed steps to flush events periodically from the RudderStack SDK’s internal database to Rudder Server.
Last updated
Was this helpful?
Detailed steps to flush events periodically from the RudderStack SDK’s internal database to Rudder Server.
Last updated
Was this helpful?
RudderStack supports periodic flushing of events from the Android SDK to RudderStack, irrespective of whether your app is opened or not. This ensures that the events that are triggered just before closing the app are sent from the device - even if the app is not opened by the user for a long time.
To use this feature, follow these steps:
Open your app/build.gradle
and add the dependency under dependencies
as shown below:
Use withFlushPeriodically()
function while passing the RudderConfig
object to the getInstance()
API, as shown below:
withFlushPeriodically
parametersThe withFlushPeriodically
function takes two parameters:
The first parameter is the number representing the time interval for the flushing to be repeated.
The second parameter is the time unit of the repeat interval. It can be Minutes, Hours, or Days. The minimum value of the repeat interval is 15 minutes.
By default, the WorkManager is initialized on the startup of the application. However, you can initialize it only on demand by following the below steps:
Add the below provider
to the application tag of your application’s AndroidManifest.xml
.
Implement Configuration.Provider
and define the function getWorkManagerConfiguration()
in your application class as shown below:
For queries on any of the sections covered in this guide, you can or start a conversation in our community.