Is there any way to know the screen on time since last battery charge (or reboot) in Android? This time is managed by the system and it show in Settings -> Battery, but I need in my app.
Also, I know it's in Dumpsy's batteryinfo, but the generated information is about 28kb and I consider isn't useful to parse this file each time.
You can use broadcast receiver to estimate the time difference.
ACTION_BOOT_COMPLETED
ACTION_SCREEN_ON
ACTION_SCREEN_OFF
ACTION_POWER_CONNECTED);
ACTION_POWER_DISCONNECTED);
You will catch the time of booting the application,when screen goes off and back on again,also when device is connected to power and disconnected.Save the time and then find the difference according to your need.