3

I'm using location & activity recognition features of android. Used for realtime location tracking. Currently using the latest ConnectionLess APIs. I have encountered the following problem:

After starting the location, activity services, once in a while, the battery starts to get drained. The behavior is pretty strange as the entire drain is showed under Google Play Services. The drain persists even if the app is stopped, killed, etc. To my surprise, the drain persisted even when the app was uninstalled and it took a couple of full battery re-charges to come out of the situation.

I'm more or less sure that the drain is triggered by my app as multiple devices have recorded the issue and these devices are from different manufacturers and across multiple android OS versions. In ADB shell, I find com.google.android.gms taking up 126% CPU permanently as seen below:

Next, I listed all the threads under that process. Result attached below:

enter image description here

As seen there's one thread, CastSocketMulti running. All other threads are sleeping.Didn't get much on castSocketMulti other than some basic information like it is related to casting in android, etc. We aren't using anything related to casting in our app.

After, killing the process, the drain stops. Note: I found same question here, however unanswered.

Edit: Every time the battery drain happens, as above, com.google.android.gmsis listed as the number one process taking 100%+ CPU and the castSocketMulti, the only thread of that process in R status

Update: I have opened an issue here. Pls leave a star so that it may go high on priority

ranjjose
  • 2,138
  • 1
  • 24
  • 46

2 Answers2

1

I have found the exact same thing here on a OnePlus 3. I'm not rooted and can't kill the process, but using adb to clear the cache of com.google.android.gms makes the process crash and alleviates the problem for a few days.

Do you use Android Auto or Android Pay? It seems to happen more frequently when I use those two apps in particular.

Fullstop
  • 31
  • 2
  • Thanks for your reply. Killing com.google.android.gms via adb did solve the problem for a while. But it does back randomly. Another way to stop the battery drain is to switch off location temporarily and rebooting the phone. For me, this issue is triggered when I use a continuous location tracking feature of my app. I don't use Android auto or Android pay. I have opened an issue here anyways: https://issuetracker.google.com/issues/70411185 Pls leave a star so that it may go high on priority. – ranjjose Jan 06 '18 at 06:04
  • According to https://android.stackexchange.com/a/166221/5738 Google location services may have a bug that causes high battery usage if "Location History" is turned off. I guess Google has poor quality control and does not test their phones with Location history disabled and in some cases the process hangs in running state. – Mikko Rantalainen May 07 '19 at 18:30
0

OK, Google claims to have fixed the issue and they have marked the issue as 'Fixed'. Details here

ranjjose
  • 2,138
  • 1
  • 24
  • 46