Maybe something you accidentially set and didn’t remember afterwards. In any case: I’m happy that it works now
ConnectException with restricted background data (even in WiFi)
-
Using DAVdroid (1.0.5 from F-Droid) to connect to my ownCloud (9.0.0) server.
Manual synchronization of contacts/calendar/tasks works, but automatic synchronization isn’t.
What I did and what happend:
- Watch http nginx server logs for requests from android
tail -f /var/log/nginx/access.log | grep -i android - Run DAVdroid on the phone
- Set contacts/calendar/tasks sync interval to 5 min or at local changes
- Perform manual synchronization
There is entries in a log with requests from android - Enable log to external file
- Wait more than 10 minutes, DAVdroid is still running
- Check nginx logs: no new requests
- Perform manual changes to google calendar
- Check nginx logs: no new requests
- Check Settings→Accounts→DAVdroid→[account name]:
It says “Sync error” - Disable logging
- Perform manual sync in DAVdroid account page:
There is new entries in nginx log
Contacts/calendar/tasks synchronized
Log: http://pastebin.com/7jufi9HE
Debug info: http://pastebin.com/LR8F8gbX - Watch http nginx server logs for requests from android
-
2016-04-03 14:42:33 26 [syncadapter.SyncManager] I/O exception during sync, trying again later EXCEPTION java.net.ConnectException: Failed to connect to example.com/92.249.104.14:443
DAVdroid is not allowed to connect to the server. I guess this is some restriction imposed by Android. Try to disable power-saving for this app (in Android 6, “doze” has been implemented which behaves exactly like this), but it could also be some other option like “restrict background data” (set either system-wide or app-specific).
-
It’s seems to be “restrict background data” option was enabled for DAVdroid
Disabled it and auto sync is now working
But I don’t understand why it was not working since wifi was connected all the time . I expect restricted apps to still be able to work with wifi, as it follows from FAQ https://davdroid.bitfire.at/faq/entry/sync-only-when-wifi-available/
Maybe wifi goes sleep, but wifi power policy was set “Smart(Switch on automatically when data transfer)” and I wake up it for sure when unlock the phone and there still was no sync…weird -
Since 1.0.6, please use the DAVdroid account setting “Sync only over WiFi” instead of restricting background data.