Corona app draining the battery on my Android phone ?

My Nexus 6P, which comfortably lasts a day of heavy usage, woke me this morning about only having 15% juice left. This is very unusual so I check out what was draining the phone.

As it turns out it was one of my own apps that has the “honor” of being at the top of the battery usage list. Even if it’s far from the one being used the most.

So, what should I look (out) for regarding my Corona apps draining the battery?

I’m running Android 6.0.1

#1 To be clear, you’re saying it is using lots of juice while your app is running right?

#2 The way you wrote this made it sound like your phone was draining fast while suspended (i.e. while you were asleep I assume your phone was too.)  

  • If your phone drains lots of power while suspended and the drop drainer is still your app, that would be interesting.

However, I assume you mean #1.  In this case, I’d look for:

  • enter frame listener(s) that do a lot of work and run all the time.
  • code that causes a lot of re-drawing (especially if not needed).
  • Event listeners that do lots of work and listen for noisy events like the accelerometer. 

You can also try profiling your app.

Ya that would be weird.

#2 The way you wrote this made it sound like your phone was draining fast while suspended (i.e. while you were asleep I assume your phone was too.)  

If your app is made in Corona it’s not possible to let the app run when the phone is suspended. Unless your using enterprise and did it that way somehow. 

–SonicX278 

Are you setting the idle timer in your app?

Unfortunately I cannot prove if it’s #1 or #2 as the battery usage report is not detailed enough in Android 6.0.1. I went to bed with 55% or so and the 15% warning woke me up. When checking what had used the battery, my app was on the top with ca 15% of the total. When this usage has taken place I do not know, but I know this:

A ) I have never seen such a usage from any of my apps before. Usually the screen is what uses the battery most and any Corona made app is a good bit down on the list.

B ) I have never experienced such a dramatic battery drain at night before

So I naturally made a connection between A and B and suspected that my app was misbehaving, but surely there could be something else going on…

The problem is, of course, that this should not be technically possible (as far as I have understood).

No enterprise involved and yes, I don’t get it.

No.

#1 To be clear, you’re saying it is using lots of juice while your app is running right?

#2 The way you wrote this made it sound like your phone was draining fast while suspended (i.e. while you were asleep I assume your phone was too.)  

  • If your phone drains lots of power while suspended and the drop drainer is still your app, that would be interesting.

However, I assume you mean #1.  In this case, I’d look for:

  • enter frame listener(s) that do a lot of work and run all the time.
  • code that causes a lot of re-drawing (especially if not needed).
  • Event listeners that do lots of work and listen for noisy events like the accelerometer. 

You can also try profiling your app.

Ya that would be weird.

#2 The way you wrote this made it sound like your phone was draining fast while suspended (i.e. while you were asleep I assume your phone was too.)  

If your app is made in Corona it’s not possible to let the app run when the phone is suspended. Unless your using enterprise and did it that way somehow. 

–SonicX278 

Are you setting the idle timer in your app?

Unfortunately I cannot prove if it’s #1 or #2 as the battery usage report is not detailed enough in Android 6.0.1. I went to bed with 55% or so and the 15% warning woke me up. When checking what had used the battery, my app was on the top with ca 15% of the total. When this usage has taken place I do not know, but I know this:

A ) I have never seen such a usage from any of my apps before. Usually the screen is what uses the battery most and any Corona made app is a good bit down on the list.

B ) I have never experienced such a dramatic battery drain at night before

So I naturally made a connection between A and B and suspected that my app was misbehaving, but surely there could be something else going on…

The problem is, of course, that this should not be technically possible (as far as I have understood).

No enterprise involved and yes, I don’t get it.

No.