Saturday, January 26, 2013

Frequently Asked Questions - GSam Battery Monitor


GSam Battery Monitor and KitKat

As of version 3.3, GSam Battery Monitor is now fully compatible with Android KitKat (4.4) for non-root devices.  If your device is rooted however, there are more statistics that GSam can collect.  So if you have root, make sure you install the GSam Battery Root Companion app.  If you don't have root - no problem, things will still work well, but some stats such as app wakelocks will not be available.


Unfortunately, Google has removed the ability in KitKat (4.4) for non-system applications to access battery statistics.  On versions prior to KitKat, GSam obtained battery statistics from a built-in set of statistics from Android.  If you have root, we can still get at that data.  If you do not, then GSam will track as much of that data as it can by itself.   Not all data can be tracked however.

Permissions:

In order to manually track usage for non-root users in KitKat, we had to include 2 new permissions.  READ_PHONE_STATE and ACCESS_WIFI_STATE.  These were added so that we know when the phone and wifi are in use so we can correctly show the respective power drain.  Google Play users who are not using KitKat will not see these permissions, but KitKat users will regardless of whether they have Root or not.

If you have root:


There are a number of ways around this - unfortunately, all of them require Root.
  1. Use the GSam Battery Monitor - Root Companion app.  This app will walk you through installing it as system privileged app.  Once done, GSam Battery Monitor will behave as before.  This is the preferred way...    OR
  2. Copy GSam Battery Monitor apk directly into /system/priv-app/.  This works well for the Free version, but is more challenging for the Paid version, requiring hoops that do not work for everybody.
  3. Use the XPosed Module that we wrote.  This of course requires that you have the XPosed framework installed - and then you need to install linked module.  This works well, and provides a more generic solution that works not only for GSam Battery Monitor, but for other apps as well.  We still recommend option #1 above as it is the lowest risk mechanism - but if you already use XPosed, then this route is a great alternative.


Why do some Apps show higher usage than I would expect?

If you are fairly confident that an app really isn't using as much power as GSam Battery Monitor reports, it could be a problem with how Android reports it's sensor usage.  Some devices coupled with certain levels of Android don't correctly report sensor usage by apps.  Specifically, it appears that an app has continuously used a certain sensor (such as the accelerometer), thereby triggering a very high power drain relative to other apps.    So if your app is showing that it has a high sensor usage - but you know it doesn't, then go into Preferences -> Device Power Profiles -> Include Sensors.  Uncheck this (do so when you are plugged in).  

Things should start correctly showing usage.  Unfortunately it means that the app can't take sensor usage into account, but if your phone isn't accurately reporting that to begin with, it's better off not included.

The notification icon doesn't update, and I have to open the app to see the latest.

The battery monitor has to run in the background to keep posting the latest battery stats to your notification bar.   Things such as task killers, or memory cleaners will stop the the background service.  It will restart on it's own, but if it gets stopped too many times in a certain time span, Android will lengthen the restart time.  Android itself will also stop background tasks automatically when it needs resources (hence why task killers are not a good idea - Android already does this).  If your phone is running too low on resources and has lots of apps competing for these resources, the battery app will get stopped by design.

If you want to override this behavior, enable the following preference:  Preferences -> Device Power Profiles -> High Priority.   Do this with care though.  It sets GSam to run in a mode where it will only get stopped if the system is really running low on resources.  If you don't have an update problem, don't enable this.

There are other reasons it could be happening - but try this first.  If this still doesn't resolve your issue, please contact us so we can help!

My tablet reports Phone usage - but it doesn't have a phone.  Why?

Some device manufacturers don't always correctly honor Androids API to determine if a device has Telephony support or not (that's you Nook).   Please email us and let us know the specific device - we'll update a table of specific devices so that it reports things correctly for you!

Sunday, January 20, 2013

Support for Kernel Wakelocks

Version 2.28 of GSam Battery Monitor has added support for displaying Kernel Wakelocks.  Kernel wakelocks are a very advanced feature, and are not intended for your average user.  Indeed, I see so many users getting confused by them in forum posts that I have resisted the urge to add them in.  They are often unique per phone / manufacturer, and a high wakelock time is not necessarily indicative of a problem.

All that said, kernel wakelocks are very useful for folks trying to diagnose custom ROM problems.  If you're running a custom ROM and are seeing battery issues, kernel wakelocks are very useful, and can help the ROM developer understand what is going on.  For people using stock ROMs they are useful to simply understand how their phone usage affects their battery life, however this takes a lot of understanding and often a lot of research reading code to understand what a certain wakelock does.

So - use with caution.  Click on the wakelock and select the Google Me button to do a quick google search on the wakelock.  Most likely this will lead to an XDA-developers forum post by somebody using Better Battery Stats (great App BTW) to view their wakelocks.  Sometimes the info is informative, but more often than not they are red-herrings and very un-useful.  Things such as 'X Wakelock is killing my battery!!!!!!'

Remember:  Just because a kernel wakelock has a high value, doesn't mean there is a problem!  The wakelock may be occurring while the screen is on (in which case who cares)

When to look at kernel wakelocks:  When your 'Held Awake' usage is high, and your Kernel has the bulk of it.  In that case, dig into the kernel wakelocks.   If your normal apps account for most of the Held Awake time, then you can safely ignore the kernel wakelocks.

Sunday, December 2, 2012

The Perils Of Publishing A Bad Update (AKA Why Test?)

Mea Culpa - my apologies to the entire community that uses and relies on GSam Battery Monitor.   This bad update (version 2.23) should have never gone out the door!  The latest version on Google Play (version 2.24) fixes the force close issue.

Yesterday (Sat Dec 1) I worked on a few updates and bug fixes to GSam Battery Monitor.  I got them all working and tested on my various test devices, and I was ready to publish.

Publishing is a pain.  I have 6 different builds to run.  2 for Google Play (free & paid), 2 for Amazon Appstore, and 2 for the Nook Store.  I do each one manually - yes, I know...I should have automated this a long time ago).   Once built, I will test install one of the builds onto a phone - make sure it installs and do a very basic test (I've already done my full code tests before the formal build).  Then I have to go into each 'store' and upload them.  It's easy enough when there are no screenshot changes - but it still takes about 5 minutes per item per store.

I published version 2.23 into all 3 stores, and then went out for the evening.   Once the update went live (takes about 2 hours on Google Play), my inbox started filling up - and fast.  With over 100K active users, you can imagine how quickly.   The free version on Google Play was completely broken - nothing worked.  It force closed immediately.  Yikes!  How did I let that happen?

Turns out, my manual export/build didn't include all of my layout and style XML files.  The code wasn't bad, it was just a bad build (argh - why the android export claimed success I don't know).  And it only affected the free version on google play (I had tested/verified the paid version).

Lessons Learned
  1. Test install and sniff every single build output.  Just validating 1 of the six simply is not good enough.
  2. Move over to an automated build.  Not sure that would have helped here, but it will at least speed things up, making me less likely to mess up.
  3. Admit your mistake and get a fix published ASAP.  Fortunately I was able to get an update out there within a few hours.

How this affects the Brand and the apps reputation


Needless to say, an apps reputation is what makes or breaks it.  There are hundreds of battery monitors out there.  There are a few that even perform very similar function to GSam.    Reputation is based on word of mouth and forum postings - and a huge update failure like this doesn't help!  

I'm posting this the day after - so I don't have much data yet, but here are some interesting stats:
  • App Rating:  4.653 before the update to 4.633 afterwards.   That may not seem like a huge drop, but it is.  Went from 37 1 star ratings to 62 in just a few hours.  That's going to leave a mark!
  • Active Installs:  This usually increases around 500 a day, and instead dropped 472.  This is the number of installs - number of uninstalls.   Hopefully that trend doesn't continue!
  • Forum Postings:  A quick google shows a few forum postings warning folks to stay clear of the update (and rightly so).  Those things stick around - so 2 months from now folks may stumble across them and think there is still a problem.
  • Paid App Installs:  So far, there hasn't been any affect to the number of sales.  Most of the sales come from folks who have used the free version, and like it.  Hard to convert folks over from free to paid when the free version doesn't work!   Hopefully this continues (the paid version didn't break after all), however I'm not holding my breath.
I am heartened however by the number of folks who have written in thanking me for getting a fix out so quickly.  There are only so many 'Epic Fail' emails you can read - even though they are deserved :)

Samsung GSII Issues

The GSII makes up about 9% of my install base.  I had 3 users write in saying that the force closes were effectively putting their phones into a constant reboot cycle.  With just one user, I would say it was a pure coincidence, but with 3 folks writing in, something strange is going on!   First off:
Samsung - how in the world do you allow a user-space app without much in the way of special permissions crash your phone?   This completely breaks the whole concept of app isolation that Android provides.   I can understand having a bug that allows a malicious app cause harm, but trust me - there is nothing malicious in this app!   Googling around shows me lots of incidences of this happening...
As of this writing, here are where things stand:
  1. One user was able to get in and uninstall the app before the phone rebooted again (took him many many tries).  After that, the phone went back to normal.
  2. One user tried an ODIN flash maintaining his data.  He then was able to finally get in like the person above and uninstall the app.  Unfortunately, he is still seeing a boot-loop.   Let's hope it can be resolved without a factory reset.
  3. One user ended up factory resetting.  When all else fails - but yikes.
 

Tuesday, November 13, 2012

Icon Pack - Overlay Support



The GSam Battery Monitor Icon Pack contains support for overlaying your default battery icon.  Take a look at the top right of the screenshot below.  You see the 12?  That's the overlay icon, replacing the normal drab battery icon that doesn't show you any details.


Why Overlay?
  • Some devices don't show the icon in the normal notification bar, so you have to drag down the notification to see the % of your battery.
  • A lot of custom ROMs for your phone/tablet support a 'mod' that allows you to control the battery icon itself.  Great for those who have it - but this brings you similar function without rooting your device!
  • The overlay shows up on your lock screen - so no more unlocking your phone just to see your battery %.  Some phones already show the battery % in the lock screen, but a lot don't.


Enabling the Overlay:

  1. Launch GSam Battery Monitor (any edition)
  2. Open up the Preferences (Menu -> Preferences)
  3. Choose one of the icon pack themes via the Battery Icon Theme preference
  4. Select Overlay Standard Battery Icon.  You should now see the icon in the top right corner if your screen.
  5. Select Configure Overlay Icon to further configure the size and location of the icon.
 
Overlay Configuration:

Unfortunately, every android device is different, so some customization will be required to get the icon in JUST the right place.  There are a lot of configuration options that can be somewhat complicated, so bear with me:

  • Icon Size:  This controls the size of the icon itself.  Move the slider around to see the size change and get it just right.
  • Background Color:  This controls the background of the icon.  Some of the icons are transparent, so setting the background color to Black will ensure the background battery doesn't show through.  Move the 'Alpha' slider all the way down to gain full transparency.
  • Additional Background Size:  This is similar to icon size, except it adds a padding to the icon using the background color.  This allows you to have a smaller icon, but still cover a larger background.
  • Align:  Generally Top Right is the correct location, however every device is different, so place it where you want.
  • Horizontal Padding:  This controls how far away the icon is from the edge of the screen
  • Vertical Padding:  This controls how far away the icon is from the top (or bottom) of the screen.
  • Pad For 2-Digit Hour:  Most devices have the clock all the way on the right, so when the time changes from 9:00 to 10:00, the battery icon moves to the left.  This lets you control how much padding that extra digit requires, and the icon will automatically move depending on the time of day.
  • Include Clock Pad On Lock Screen:  For devices that show the clock on the lock screen in the same way as when unlocked, this lets you enable the Pad For 2-Digit Hour on the lockscreen as well.  Most devices don't do this, so this is disabled by default.
  • Icon Brightness:  You can dim the icon if it's too bright to better match the colors elsewhere on the status bar.
  • Show only when status bar is visible:  When apps go into Full Screen mode, the icon will disappear by default.  This is typically what you want, however toggle this to make sure the icon never gets hidden.  NOTE:  Some devices (Nook Tablet & Color) where the status bar is not at the top of the screen don't support auto-hiding, and so this MUST be checked on these devices.  Hopefully there aren't may such devices.
Suggestions?  Feel free to email me with any additional features, or let me know (with a screenshot) if things don't work.  You can find my contact info in the About section on the blog.