wire-android_legacy
wire-android_legacy copied to clipboard
High power usage even when the app is not actively used
The problem
I regularly get a warning from Android that Wire is "draining my battery heavily". When I compare the CPU total in the power overview, Wire seems unusual high compared to other apps.
Environment
- Version: Wire 2.32.325 and older versions
- OS: OxygenOS OP3_O2_Open_15 (based on Android 7.1.1)
- Model: OnePlus 3
- Network: mostly on LTE
Details
Open Wire. Wire doesn't even have do be used to drain the battery, it can be open in the background.
Link to Debug logs
Agreed, it's terrible.

I am also experiencing this issue. It started after upgrading from Wire 2.30.321 and has been present in all versions since. It seems like the issue is Wire keeps the device awake. See the attached screenshots for a comparison with Telegram on the same device.

The device is running CM 13 which is based on Android 6.0.1 without Google Play Services.
Hello everyone! Is it happening with GCM enabled or not?
With the risk of sounding stupid: What is GCM and how do I know if it's enabled or not? :)
I think he means google#s push service
Hello @red-avtovo
I am observing this issue on a device without Google Play services so GCM is not being used.
Basically we are using cloud based notification service system to be able to get notifications. If we don't have ability to use GCM (Google Cloud Messaging = Google Play Services), the app is using WebSocket connection to the backend. That's why it drains quite much energy.
That makes sense, but I did not experience this in Wire 2.30.321 so I believe there is some regression that is causing this battery drain issue.
Makes sense.
Sounds like there needs to be an open alternative for push notifications then. What are all the other SMS-replacement apps doing? I googled and I see that mqtt is one idea. There must be a TCP connection always open, to the server, but it can be configured to be long-lived and not to require much maintenance traffic somehow. For example https://ollieparsley.com/2013/05/20/using-mqtt-as-a-gcm-replacement-for-android-push-notifications/ http://tokudu.com/post/50024574938/how-to-implement-push-notifications-for-android But then, that ought to be set up as a drop-in replacement solution and made available on F-Droid, so that every app doesn't have to open its own TCP connection. (Searches there...) Oh look: https://sourceforge.net/projects/androidpn/ Also https://github.com/kontalk/androidclient/wiki/Push-notification-without-Google-Cloud-Messaging https://microg.org/ That sounds like it would be worth a try.
Ideally the phone would have a routable IP address so that a central server wouldn't be required. (The rollout of IPv6 was supposed to solve the address-shortage problem.) Does that actually happen at least on some networks? If it can be detected, maybe use that technique first, then fall back to AndroidPN or MicroG on a phone which does not have GCM?
I am also experiencing severe battery drain because of wire. It started with 2.34.338 or 2.33.336, I'm not sure. I was experiencing the problems described in issue #760 , which 2.33.336 update corrected. So I'm wondering if the latest update is not able to interface with GCM. Keep awake for wire is basically the same as how long I've had the phone off the charger.
I am using a google pixel running android 7.1.2 and google play services 11.0.55.
Oki i wrote my comment already here: https://github.com/wireapp/wire-android/issues/164 I don't know which one is the correct one.
I'm using the latest WIRE version on Android, with a HTC 10 and Android 7.1.2 without gapps or any Google services tho! The Battery drain is massive and not normal or acceptable at all. I will deinstall this app until this is fixed.(good that we have desktop apps) This app drains almost my entire battery life over one day, just alone, it is ridiculous.

I love WIRE and how the devs do work on it and keep it running and improving. But this has to be handled with priority imho.
Edit: I need to add, that Telegram does not have such battery issues at all, also Conversations XMPP app does not too. In fact, no other app drains that much battery like WIRE does currently. And I do not use google play services/GCM at all, on my device, so all apps run without GCM actually for me. And therfor, MicroG is not a solution and rather more like a workaround, because it needs "Signature Spoofing" to work. Something that LineageOS does not and will not support in the future in their builds. Which I agree with.
I do not want to be forced to do that just to have good battery life on a single app when all other apps seem to have no issues with it at all. (telegram, conversations, threema etc.) I really hope WIRE devs are gonna fix this soon.
I don't believe this issue is related to GCM or WebSockets. I was using Wire with WebSockets for several months without any battery draining issues, my issues started after I upgraded from Wire 2.30.321. This was the last version that did not drain the battery for me. I would gladly downgrade to that APK as a workaround but it no longer works unfortunately
I am also seeing massive battery drain without gcm. I know wire will use more battery without google services btbi believe what we are experiencing is excessive and beyond what should be normal. There has to be a bug.
I have also corresponded with another wire user that did not have nearly the battery drain some of us are seeing. This user was on version 2.28.317.
This issue is referring to the same bug affecting the users in issue #164.
I had the same problem with two devices, one having Google Play Services (thus with GCM) but without a Google account, the other using microG (a free Google Services replacement also incl. GCM). Both devices were running fine before and the problem started as well with one of the recent Wire updates. However I could resolve the problem by manually upgrading Google Play Services resp. microG!
My speculation is: The new Wire update expects a newer Google Play Services/GCM version and if GCM is not up-to-date anymore it silently falls back to WebSocket. As a result Wire is affected by the WebSocket bug (#164) that drains the battery. If this speculation is correct, I would suggest that Wire should warn the user about the outdated GCM! Also: It would be nice if Wire could show somewhere whether it actually uses GCM or WebSocket so that one can more easily identify this. (Maybe have it in the settings – in the future this could be extended to manual choose which one to use? :wink:)
For those fellows using microG: (For clarification: microG refers to a whole project. The app that replaces Google Services is called "Services Core" or "GmsCore"). The last stable version of Services Core (0.2.4) uses an outdated version number – you need to update to one of the latest prerelease versions (0.2.4-…)! Either download it directly from the website (dropdown button reveals the prerelease versions) or update it via F-Droid (maybe "experimental updates" have to be enabled to see prerelease versions). Unfortunately there is an issue with F-Droid and microG: If you have installed "Services Core" from the microG repository, it will show up as "Unified Nlp (no GAPPS)" from the official F-Droid repository. This comment by @landry314 explains ways how to update "Services Core" nevertheless.
I'm using the latest MicroG. However, there currently was an update to 0.2.4-103 (or something like that), and I have not yet noticed the battery drain (however for me it never was so bad as some report here).
I have a similar issue with mine. The difference is that I get a notification about power draining, but when I go into details it uses far less then any other app in there, usually only 1%.
Wire (for android) version: 2.36.343 (from google play store. Android OS: 7.1.1 (Ozygen OS 4.1.6)
@Strit I think this is because it drains the power via Google Play Services, at least that is how I think it works. Google Play Services power consumption is much higher if Wire is running.
I hope someone is going to work on this issue soon. I stopped using Wire on my mobile because of this.
Might be true @freijon but I don't notice any real battery drain at all. It still has 50% left on the battery when I go to bed.
For me it's 50% in the evening when Wire is running during the day vs. up to 3 days without Wire.
@freijon: It would be interesting to know which "Google Play Services" version is installed on your phone.
The latest version seems to be 11.0.??. I am not sure about version 10 but if you are on version 9 or below, this is probably the reason for the battery drain!
(Do you use the "Google Play Store" and let it automatically update your apps? If so, it should actually update "Google Play Services" automatically…)
@Awerick: I have version 11.0.55 installed on my device.
And still the battery gets drained? Interesting, then there seems to be another issue besides(/instead?) the one I speculated…
Same issue on LineageOS without gapps. No microG eather. Battery drain ridiculously high. I downgraded to v2.30.321 as stated by @kostadinstoilov for a camarison. No battery drain, the version is buggy though. The issue obviously concerns both, GSM and WebSocket. Hope they can fix it soon.
Experiencing similiar drain on CopperheadOS, which means no gapps.
What I'm also not getting: Why is this labeled as "enhancement"? It's clearly an issue (bug?) and not a feature request. And it's a killer for me!
Any updates on this bug from the Wire team?
Hello @freijon, @CL4RSEN and everyone,
We are aware of the battery issue and it is marked 'high priority' on our end. We will most likely have a service run to fix bugs by the end of July. Thanks for all the feedback you have provided! Best,
Hi,
In case it's any use to your team, it looks like the battery issue (in my case anyway, Galaxy S7, Android 7.0) is caused by the ZMessagingService in the sync library not releasing WakeLocks:

In the latest version (2.37.349), one wakelock (FutureService) remains out of two. Had both FutureService and ZMessagingService on the previous version of Wire. Android 7.1.2, no google apps.
Battery drain still extremely high in the new version 2.37.349. Seems like nothing has chaged at this point. In my case it is 15% to 18% after one day run without any active use of wire-app (lineageOS, no gapps, OnePlus3). For me the app is useless untill it's fixed.