I'm new in developing Android applications, but for analyzing my code I need to calculate how much battery is consumed while my application is running(in mA).
I have seen some options via wake_locks or some apps, but there is 2 special requirement that makes my problem harder:
1-I need to calculate energy consumption for my activity and cannot use system overall energy consumption. for example when my application uses WiFi, I want to calculate it for scope of my activity, not system overall that could be affected by other activity.
2-I want to calculate calculate energy consumption for each device which is used in my activity rather than total energy used by activity. e.g. amount of energy that is used by WiFi in my activity, rather than overall energy that is used by my activity. even though this requirement is optional, but it helps me a lot for increasing my work precision.
3-I prefer a way that does not need rooted device.
It will not differ if I use an available app(I checked tools like Powertutor, but if more detailed will be better so I could categorized per device in activity) or I even code for it(How I can calculate energy in codes?).
I have seen some papers regarding this matter, so I think it will not be so simple.
What do you suggest for my problem?