How to get an estimated amount of talk time, music / video playback time, standby time, which can be done based on the current battery level

I am working on an amazing Android platform. I am creating an application that deals with the battery level of the phone. I show the current battery level of the phone, as well as several other technical things. I wanted to get an approximate amount of conversation, music / video playback time, a waiting time that could possibly have been made based on the current battery level remaining on the phone. Using this, the user can understand that if his battery level is 50%, then perhaps he can do another 2 hours of conversation (or) listen to 1 hour of music (or), if the phone is not touched, it lasts about 4 hours. This way it will help the user. Please help me in suggesting an approach (or) is there any API available for this.?

+3
source share
3 answers

I can’t say for sure, but I doubt very much that there will be an API for this.

I believe that the only approach available to you is to collect data and evaluate it as close as possible. You can try to measure how much energy each application / use consumes, and also try to measure the battery capacity. You need to adjust your values ​​from time to time, because batteries that are not new sometimes lower voltage, etc. Therefore, this is a moving target.

0
source

I think this is impossible to do.

As @dain shows, you can tray and measure historical data and do optimization on them, but since there are all kinds of background processes (low connection strength means a lot of searching, Wi-Fi or not, data in the background, new applications, you name it) influence this, so it’s hard to be accurate based on the data collected.

Perhaps you can target certain processes (for example, calling or using a specific application, such as a music player), and check how much energy they use on average, and move from there.

What permission do you use, I think, because of the difference in all the data, you will get some kind of average from this, which would probably be incorrect for the current situation. Perhaps you will be able to "minimum" time "maximum" for activity?

0
source

final intention of intention = new intention (Intent.ACTION_MAIN, null); intent.addCategory (Intent.CATEGORY_LAUNCHER); final ComponentName cn = new ComponentName ("com.android.settings", "com.android.settings.fuelgauge.PowerUsageSummary");
intent.setComponent (cn);
intent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); startActivity (intent);

it works for me

0
source

All Articles