To preserve battery life and customer bandwidth, the Alooma SDK doesn’t send recorded events immediately as they occur. Instead, it sends batches to the Alooma server periodically while your application is running. This means when your application shuts down, you need to inform the library to send any unsent events. Do this by calling AloomaAPI.flush() in the onDestroy method of your main application activity:

When you call flush(), the library attempts to send all unsent events. If you don’t call flush, the events will be sent the next time the application is launched (don’t worry, the events will reflect the correct timestamp!).