Relic Solution: Why Am I Seeing Inflated App Launch Count In My Android App?

New Relic users often write in to Support with different questions about their Android App’s behaviour or have questions about incomplete/incorrect data, such as app launch count. If you are experiencing any of these issues, it may help to review the Android agent install documentation.

What do I do?

The first step is to go over the installation steps outlined in our docs to check if anything was missed. We can’t overemphasize the importance of initializing Android agent in the onCreate() method of the default activity class defined in the AndroidManifest - this is typically MainActivity class. Starting the agent in another class is not supported and can cause unexpected or unstable behavior.

One known side effect of starting the agent in another class, such as the Application class, is Inflated app launch count. Background services like push notifications can instantiate the Application class which causes the agent to count additional app launches.

But what if I use deep linking and have multiple default activities?

No worries, here is another Level-up post called Relic Solution: Android initialization and deep linking that dives into the recommended options for initializing Android agent in multiple default activity classes.

Let us know if you have questions by replying in this thread.


With that, how can you use New Relic library to measure the timing happen inside the Application class (esp. onCreate() which is the major bottleneck for many applications).?

May be the library can compensate it by asking itself “Am I background? Yes, don’t count.” because otherwise, this is exactly what I am (and probably many other developers) going to try.

Hi @brian.chu , thanks for your comment! At this point, the New Relic Android agent doesn’t instrument activities when the app is background. I have filed a feature request on your behalf to express your organizations need for initializing the agent in the Application class to our product management team. Your request will be reviewed by our product managers and we’ll try our best to notify you if it’s implemented.

You may already know this, but in the meantime, you can record background tasks as below post described:

If you get a chance, you can create a feature idea in our community. This will allow other New Relic users to discover your idea and participate in the conversation by adding their use cases, possible workarounds, and even their vote.