Previous events are missing when I restart the app programly in Android?

Hi Dear,

I am working on intergation new relic on android platform. I found that the previous collected events are missing if I programmly restart the app.

Restart app I am using intent flag (clear top and new task ) to start the main activity and will kill current process in a specific case. In this case, app not have chance in background (I noticed from the log, will send data to server when app is in backgroud) and will initialize new relic after start.

Is there any way to report data to serve manually with NewRelic? If not, then how to handle this case to report previous data ?

Thanks

Hi Ida,

Welcome, and thanks for posting to the community!

There are three instances in which the Android agent will send event data to New Relic:

  • The app enters the background state
  • The app runs in the foreground for the configurable buffer time (default: 10 min)
  • The app crashes and then is relaunched

In your case, it sounds like the app doesn’t have the chance to enter the background state, so the data is lost. Other than backgrounding the app, we don’t have a programmatic way of sending the data to New Relic. The buffer time I mentioned above is 10 minutes by default, but you can configure this using the setMaxEventBufferTime() API call. If you set the value to a lower number, data will be sent more frequently by the agent. For example, setting the value to the minimum of 60 would mean any stored event data is sent to New Relic every 60 seconds, rather than when the app is backgrounded or the 10 minute default.

I hope that helps! Please let us know if you have any further questions on this.