Calendars show up in DAVx5 but not in Android



  • Hi, I have logged in my calendar using DAVx5 and, although the calendars and addressbooks show up in the DAVx5 app, Android cannot find them. This happens both with a Posteo and a Radicale account, which work normally on my laptop with Thunderbird.

    On the Android end, I’ve tried several Android calendar apps, such as the stock calendar, Etar, and simple calendar, but none of them seems to be able to find the calendars: when I choose “Calendars to Sync”, the phone keeps loading forever.

    Log: https://pastebin.com/6cgEMykV



  • Hi,

    did you read the help page for synchronization problems? I strongly suggest a read of this page because you have a Xiaomi device. Does it help?

    https://www.davx5.com/faq/synchronization-is-not-run-as-expected



  • Thanks for your reply.

    Yep, I am aware of the page. I have already disabled the battery optimisation for DAVx5:

    Power saving disabled: yes
    

    Having said this, I’ve installed LineageOS in place of the MIUI, so I’m not sure whether this would apply anyway. Finally, correct me if I’m wrong, power saving would only prevent automatic synchronisation.

    My issue here is not synchronisation between the server and my phone. I can see the calendars on DAVx5, but even after manual refresh they do not show up in Android apps.



  • Issue seems resolved after a factory reset.



  • And… no. It got stuck again. DAVx5 syncs once after the reset, then refuses to do so.

    I have disabled battery optimisations and allowed unrestricted data for DAVx5 but no dice… It does find calendars on the server, but refuses to synchronise the events.

    I have no idea whether this may be an Android or a DAVx5 issue. Any pointers would be greatly appreciated.

    Extended log while hitting the synchronize button: https://paste.fedoraproject.org/paste/pdQXyuU7~J8N8lTIhQ1oLQ/raw


  • developer

    Is there an active “privacy guard” or something like that?



  • No. Privacy Guard is off for anything related to DAVx5, calendar or contacts.

    I’ve made it to sync calendars and contacts again today by deleting all local Calendar and Contacts data, completely re-installing DAVx5 (again), re-granting permissions and then re-linking calendars through the “Add calendar” button on the stock Calendar app.

    Now creating a test event on the Android calendar and manually syncing seems to create an event on the server side, too. The same is true for creating an event on the server and downloading on the phone. (YAY!)

    I’ll test in the next few days, hoping it was a fluke.

    Thanks for the assistance so far.



  • @pescepalla said in Calendars show up in DAVx5 but not in Android:

    Posteo

    Still problems with posteo! (search the forums to see what i mean)

    I tried it a short while ago; their calendar format seems to be complete incompatible with android or caldav.
    Or just broken.

    That said, it should show something, so maybe this is just a side remark.



  • @nihili That may be, but I tested with a Radicale calendar and I had the same issue, so at least in this case I wouldn’t blame Posteo.
    Moreover, I used the service mostly without hitches for several months and only stopped synching a few days back.



  • This morning I woke up and the problem presented itself once more.

    I happened on this post which describes a problem very similar to mine.

    The failure to synchronise might be due to the fact that Android tries to reach Google but fails due to the fact that I am located in China behind the Great Firewall. As a consequence, it assumes I’m offline, thus killing the synchronisation.

    The solution is stopping Android from trying to reach Google. To do so on an Android 9 device with SELinux set as enforcing it is needed:

    1. Open Termux with root access:
    $ su
    
    1. Set SELinux as “permissive” for the current Termux session:
    # enforcing 0
    

    Then there are two options. First, disable the check altogether with:

    # settings put global captive_portal_mode 0
    

    The second option is to have Android ping the right servers (i.e. not blocked by the GFW):

    # settings put global captive_portal_server g.cn
    

    After a reboot, the WiFi symbol should lose the annoying “x” on it and DAVx5 should be able to sync again.

    Now I’ll test again tomorrow in case I’m completely wrong.



  • Okay, working so far. I think I could mark this as solved.

    The downside of entirely disabling captive portal detection solution is that Android then won’t be able to access networks which require a login (like my workplace).

    A better solution is to define a reachable server for China. The following works on android >= 7

    $ su
    # setenforce 0
    # settings put global captive_portal_mode 1
    # settings put global captive_portal_http 0
    # settings put global captive_portal_https 1
    # settings put global captive_portal_https_url https://connect.rom.miui.com/generate_204
    

    Optional:

    # settings put global captive_portal_fallback_url https://www.qualcomm.cn/generate_204
    

    Then reboot.

    Other valid servers for generating a 204 are listed here. Google ones don’t work for me though.

    Hope this helps someone out there.


  • developer

    @pescepalla Aren’t these settings lost when the device is rebooted? I had to add them to a startup script.



  • @rfc2822 No, at least not in my case. Rebooting is in fact part of the operation and after a couple of reboots the settings still hold (the “x” over my WiFi symbol is gone and DAVx5 syncs).

    Not sure what will happen with upgrades. I guess time will tell.



  • @pescepalla Thank’s a lot! Your solution workes on my Xiaomi 5s plus with nextcloud on an own server in my LAN and using DAVx⁵ for synchronisation after I’ve searched two days where the problem comes from. By accident I installed nextcloud 15 and deleted and reconfigured DAVx⁵’s account. So I was not clear if it’s a nextcloud or a DAVx⁵ problem. Finally I found out in the nextcloud logs an entry

    webdav	Sabre\DAV\Exception\NotAuthenticated: No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured
    

    Still misleading, I checked everything related with passwords and accounts.

    Android doesn’t sync if it can’t connect to a working captive_portal_https_url, even if you choosed in the internet access settings for your network not to ask the question anymore and the internet works as far, as possible in China. And that with LineageOs. As many people not only using their own local nextcloud installation inside a LAN that is kind of a strange setting with Android in China at least.

    Thanks again, @pescepalla !


Log in to reply
 

Similar topics