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:

    1. Watch http nginx server logs for requests from android
      tail -f /var/log/nginx/access.log | grep -i android
    2. Run DAVdroid on the phone
    3. Set contacts/calendar/tasks sync interval to 5 min or at local changes
    4. Perform manual synchronization
      There is entries in a log with requests from android
    5. Enable log to external file
    6. Wait more than 10 minutes, DAVdroid is still running
    7. Check nginx logs: no new requests
    8. Perform manual changes to google calendar
    9. Check nginx logs: no new requests
    10. Check Settings→Accounts→DAVdroid→[account name]:
      It says “Sync error”
    11. Disable logging
    12. Perform manual sync in DAVdroid account page:
      There is new entries in nginx log
      Contacts/calendar/tasks synchronized

    Debug info:

  • developer

    2016-04-03 14:42:33 26 [syncadapter.SyncManager] I/O exception during sync, trying again later
    EXCEPTION Failed to connect to

    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
    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

  • developer

    Since 1.0.6, please use the DAVdroid account setting “Sync only over WiFi” instead of restricting background data.

Similar topics