AquaMail Forum
English - Android => Bug reports => Topic started by: d_d on March 20, 2017, 09:29:32 pm
-
Hi,
First of all - great app, the best email client on Android I know of.
I have a setting of sync every 1 minute. I recently switched from Android 5.0.1 to 6.0.1. On the former AquaMail was 100% reliably syncing every 1 minute. On Android 6.0.1 It is syncing every 1 mintute only when the charger is on, if I unplug it reverts to 5 minutes interval (which is not enough for my use case).
Now I am aware of the continued quest of the Android team to make life of people who want to schedule frequent repeating alarms miserable. I am aware of the doze mode in Android 6 for example but its not that, the phone is not in doze mode and another app on my phone is successfully scheduling alarms every 15 seconds using AlarmManager.setExact() at the time AquaMail reverts to 5 minute syncs. Aqua mail is also excluded from battery optimization. So I am sure this can be fixed.
I can provide logs if needed.
-
Hi, if you need to get incoming messages instantly, I recommend using the push service for the folder with an IMAP or EWS account.
-
+1 to what @nica wrote.
Recent Android versions limit how often an app can work in the background -- even if it's excluded from Doze Mode. Google knows better :)
-
Hi.
I have the same issue. But my scheduling period is 1 hour. My ref.point setting is 00:00 . This setup worked perfectly before (but I've been using an older version, before the major changes). Now I'm on Android 6.0.1.
AquaMail syncs (checks in the background) imap accounts not at exact hour boundary but fluctuates +- 5-6 minutes.
I'm also sure this can be fixed (if made on purpose?!) because other apps are able to schedule their alarms/actions at the exact minute, even second.
Could anyone shed more light on this issue?
-
You may want to read the FAQ, the item "Persistent network errors or the app not checking mail (any phone, with specifics for Android 6+, Xiaomi MIUI, Huawei)".
http://www.aqua-mail.com/?page_id=227
-
Thanks.
But all those things are looked after. Xiaomi phone. Battery optimizer/saver is off, Cleam master thing is disabled (Cleaner), and threr is no button or anything in Mail/Receiving about any Doze mode, I guess it is whitelisted.
The problem is AquaMail checks for mail not at exact hour but anything between :00 and :09.
Again, other apps (like reminder apps) are exact always, below the minute.
Anyway, I guess I'll have to get used to that. If this is a Marshmallow issue of some kind, I'll have to say older Androids were better.
P.S. Today it's worse. It won't even check. I started it tens of times after the "exact hour" just to make sure it's running, nothing. Before, if any network error during check, it would display a red exclamation next to accounts in main screen. Now it just displays the last time it checked and nothing more.
Xiaomi redmi 4 phone. I disabled battery saver/optimizations, included aquamail in exceptions beforehand (just in case), Cleaner(master) is disabled, in settings there is no button to allow Doze, etc.
Memory optimizaion in Developer in MIUI is set to Low. Aqua is added to Autostart permissions.
Other apps are scheduling themselves just fine.
I can manually initiate a check through the program and it connects and checks for mail correctly, it only quit auto-checking on a schedule every hour.
Aqua is the best email client, I was very happy before, I'm a Pro customer.
Unfortunately it seems I'll be on a journey to find an alternative client. This cannot be tolerated, even if MIUI is at fault. If other client fails too then I'll take my words back.
Thanks.
P.S.2. Maybe if I could send the debug log of a 5-minute_late_scheduled_check situation so Kostya would analyze and come up with what's wrong...?!
-
The symptoms you describe sound like something else is still not allowing Aquamail to run at the scheduled time. And since one of the known issues that you were not able to confirm yet is the doze mode, I would recommend verifying that.
(Note that the fact that Aquamail displays only "the last time it checked and nothing more", suggests that it was not allowed to run at the scheduled time, - so it didn't have a chance to connect.)
I don't have 6.x Android, so, I cannot advise you on how to find the option (beyond the FAQ). But if Aquamail has not prompted you to whitelist Aquamail, that's what I'd check first to make sure Aquamail is whitelisted.
If you cannot find the button in Aquamail, - check it (and whitelist) directly in Android settings. Follow e.g. these instructions how to do that:
http://www.valuewalk.com/2015/11/how-to-stop-apps-from-using-doze-on-android-6-0-marshmallow/
Note that some other email apps store your messages (and your login/password information) on their servers in the cloud, and that allows to work around the doze mode in a different way. But would you like your messages to be stored in the cloud by the mail-app company?
-
Thanks for the reply.
No signs of such "Doze" mode here. I turned off all battery optimizations and savers in MIUI.
In fact, now it checks every cycle, just most of the times it is late by about 1 to ~10 minutes after the moment it should check. I set it up to do it every 30 minutes with ref.point 00:00 and no settle-in-time.
I turned On debugging and when there was 10 minutes offset I turned it back Off and took a look at the debug txt file. It shows Aqua correctly "thinks" its next schedule to be at 10:30 (as example). Then I see the "intent" seems to have happened at 10:40 (and not 10:30). E.g. I think this is when the OS called for Aqua to do its thing.
Strange thing is about half of the times it checks on time, maybe not to the second but down to the minute.
I wonder if this is something new in latest versions.. Previously I had JB4.2 AOSP with older Aqua version (2-3 months old before the major changes) and it was working perfectly. I have the feeling it just has some new bug by not scheduling itself at the right times sometimes. If not most, but half of the cases it checks at the expected hour:minute. Although not at the exact second (zero second).
Otherwise I still find it the best email appm that's why I'm looking for the cause for this behavior.
For the sake of this I'm testing other email apps to see if they behave like this.
P.S. It's 12:54 and Aqua's last check was 12:00. It missed 12:30. This is unacceptable, I'm sorry.
P.S.2. Today it missed 2 or 3 schedules EVEN while I was actively using the phone at those exact times.
P.S.3. Trying a competitor email client. The one with the sky color in the name. It schedules and checks for mail exactly at the second. Every time! So it seems the problem is in Aqua. Where could I file a bugreport? I still want to use Aqua as it has finer control on mail handling.
P.S.4. It seems the more actively I'm using the phone (especially during and around the time it should execute its schedule), the more frequently it misses its schedules.
The other email client works perfectly on time, no matter for how long the phone is asleep, or using it actively.
-
Re: MIUI
We had reports of this or similar issues on Xiaomi devices.
Based on a couple of debug logs, the phone's software doesn't call our code at the right times (late) or at all (sometimes).
-
Reminder apps are working correctly, every single time. THey schedule an alarm to notify about an event.
How do they do that without a glitch, on the same phone(s), numerous times a day?
Just asking, not blaming anyone.
Also, I'm not android programmer, but this issue is dribing me crazy and before I change phone for another brand, I'd like to dig some more. I found opinions of using some different approach, spawning a service or something... no matter it would consume some RAM... I don't know, this is very frustrating, and it seems it doesn't affect your app only.
-
Do these 'reminder apps' need connection to a server?
-
Do these 'reminder apps' need connection to a server?
No. Why?
Kostya said Android didn't call the app's code at the right times in the first place. It hadn't have the chance to be called, what left to try to connect to a server.
-
Yes, some manufacturers -- e.g. Huawei, Xiaomi -- deliberately break Android in order to get better (lower) battery usage.
They usually provide a way to turn it off, app by app, and sometimes it works but sometimes it doesn't. There is information on this in the FAQ, near the end.
I do know however that on _some_ Xiaomi models, even this doesn't always help.
Re: BlueMail (Type Mail, etc.)
Uses a completely different approach, which has some good sides but also some bad sides (wrt. to privacy, and also expensive to implement and support: Cloud Magic is $50/year so that's how much it costs or thereabout, and yet there are cloud based mail apps that are free and don't even contain ads...).
And them some apps may get special treatment from these "manufacturer specific optimizations". I have seen code on a Samsung phone that made exceptions for Gmail, Google+, WhatsApp and a few other apps.
I'm sure that none of this helps the original post author, who just wants Aqua Mail to work on his Xiaomi.
Sorry we don't have a "workaround" except Xiaomi's official "white list Aqua Mail in the phone's settings", and if that doesn't work, sorry there isn't anything else I can suggest.
-
Hi, and thanks.
I have to admit, bluemail, type, droidmail were what I tested. All of them failed the same way, to use scheduled check reliably.
I switched to push mail and for now it works as expected, 2-3 days later.
Just out of curiosity, I contacted the author of the reminder app I'm using (on JB4.2 before, now on my xiaomi). His app has no problem to be called/awaken by Android on the specified moment in time, always. As a side note - not actually on time to the second but exactly 30 seconds ahead of its scheduled moment. This 30 sec offset was present on JB4.2 as well.
And I've done that because as I got it, aquamail's code wasn't called on time (if at all) by the OS in the first place, so it shouldn't have to do with the fact Aqua uses the network there.
This is the code he is using successfully.
public static void setExactAlarm(final Context ctxt, final int type, final long triggerAtMillis, final PendingIntent pi) {
final AlarmManager alarms = (AlarmManager) ctxt.getSystemService(Context.ALARM_SERVICE);
if (VersionUtils.isMarshmellow23__6_0_OrLater()) {
alarms.setExactAndAllowWhileIdle(type, triggerAtMillis, pi);
} else if (VersionUtils.isKitKat19__4_4_OrLater()) {
alarms.setExact(type, triggerAtMillis, pi);
} else {
alarms.set(type, triggerAtMillis, pi);
}
}
I don't want to sound teaching or something, not at all. Just if this could ring any bells as to how this problem could be resolved.
Thanks.
-
RE: I don't want to sound teaching or something, not at all. Just if this could ring any bells as to how this problem could be resolved.
Aqua Mail uses setAllowWhileIdle
The "exact" versions -- setExactAndAllowWhileIdle and setExact -- are undesirable because they prevent Android from "coalescing" nearby wake-up alarms.
-
Ok. All I want to is apps to work reliably. I don't have many "alarms" that need to coalesce (with all advantages of this method) anyway. I want every single alarm/event to fire on time. I have a big battery.
This reminder app is just working reliably.
Maybe an advanced option somewhere for use of this "exact" method, called something like "alternative schedule method for special devices" wuoild solve issues like this?!
-
Re: All I want to is apps to work reliably.
It does work reliably except on certain phone models from certain manufacturers which deliberately break Android.
BTW, the "alarm window" (coalesce interval) used by Aqua Mail is 30 seconds.
Re: I don't have many "alarms" that need to coalesce
"alarms" isn't just "morning wake up alarms"... I don't think you have a way to know how many alarms are actually used / fired by all the software on your phone.
Re: This reminder app is just working reliably.
Good, it means your phone's manufacturer did not break the "exact" methods.
There is nothing to prevent it to do this in the future, accidentally or intentionally.
Until recently, even on Xiaomi phones, "whitelisting" Aqua Mail in MIUI settings was enough to make it work reliably and predictably.
And then Xiaomi broke this, accidentally or intentionally.
Re: Maybe an advanced option somewhere for use of this "exact" method,
Nah, a setting would only be discovered by maybe 1% of users who need it.
If we do it, the code will use it automatically (maybe detect Xiaomi in general, maybe certain models).
---
But this is what really amazes me:
Your phone's Android is deliberately broken by the manufacturer.
Why not demand a fix from them?
There are tens of thousands of different Android device models out there right now.
They're all supposed to work the same and not require any "magical" fixes ("use function A which works instead of function B which works on all devices except those from this manufacturer that decided to break it")?
-
Re: If we do it, the code will use it automatically (maybe detect Xiaomi in general, maybe certain models).
Done, let's see if it makes any difference:
https://www.aqua-mail.com/forum/index.php?topic=5640.0
-
Ok, you are 95% right. I was not supposed to insult or anything and I'm glad you didn't accept it that way.
Here's what I think, I might be wrong.
If 'exact' methods do actually work as expected, then it's as it's supposed to be - the very fact methods with 'exact' in their name exist assumes methods with no 'exact' would work differently - the way you described it (nearby alarms coalesced to fire at once on predefined interval frequency). That's why I assumed 'exact' should be used when there are important alarms/notifications that need to attract user's attention at exact moments (if the user wants it through a setting for example).
For now I switched to Push, and it works Ok so far. Still once or twice it missed a mail but it might be google's gcm servers fault.
I'll wait for the next playstore version before I'll give it a test, because I need my email to work reliably and I'm not inclined to test beta or so versions.
Out of curiosity, what change did you do for the experiment? using 'exact' for xiaomi devices?
-
Re: Out of curiosity, what change did you do for the experiment? using 'exact' for xiaomi devices?
Yep.
setExactAndAllowWhenIdle
Re: That's why I assumed 'exact' should be used when there are important alarms/notifications that need to attract user's attention at exact moments
Yes that's the idea.
Or - "when a manufacturer deliberately screws up their phone" :)