Nextcloud not writing to, reading from files on Android (LineageOS) phone

Nextcloud version: 15.0.2
Operating system and version: Ubuntu 18.04
Apache or nginx version: 2.4.29
PHP version: 7.2.15-0ubuntu0.18.04.2

Phone is a Moto G4 running Lineage OS with MicroG. This means I don’t have Google Play Services and can’t get notifications. The app will tell me this. I don’t need notifications, but I’m hoping this isn’t the cause of my auto-sync problems, which I’ll describe below:

I’m running Nextcloud at home to sync my laptop and phone. I have a tower with Nextcloud installed, and it seems to be mostly working. I can sync from my laptop to Nextcloud, I can see the files on my phone with the Nextcloud app, and I can use Nextcloud notes to see my notes.

If I edit a note with Nextcloud Notes, it will update the cloud and update on my laptop. However, Nextcloud will not update the actual file on the device.

If I set, for instance, /storage/emulated/0/Documents/CloudNotes as an auto-upload directory, I can get this directory to upload to NextCloud, and I will see it on my Laptop. If I install the Notes app in Nextcloud, and link my ‘CloudNotes’ folder to this directory on my phone, I can use the Nextcloud Notes app to edit my notes, and when I edit them the changes will appear on NextCloud and on my laptop.

However, If I go back into the actual folder on my phone where I have the file, and view the file with a text editor, I can see that my changes are not there. The changes are only at /storage/SD/Android/media/com.nextcloud.client/nextcloud/user@tower/%2Fcloud/CloudNotes and not the original file location.

If I use the text editor to change this file, or any file in this directory, Nextcloud will not pick up the change and sync it. If I add anything after the first initiation, Nextcloud won’t pick it up. I have to use the NextCloud app to add it manually. So it seems totally parallel: Nextcloud is managing the files totally independantly of what’s actually in my phone’s filesystem.

The output of your Nextcloud log:

You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /var/www/html/cloud/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18

(But I should mention that I installed intl and it stopped the error message, but not the problem.

The output of your config.php file:

  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'tower',
  ),
  'datadirectory' => '/var/www/html/cloud/data',
  'dbtype' => 'mysql',
  'version' => '15.0.2.0',
  'overwrite.cli.url' => 'http://tower/cloud',
  'dbname' => 'cloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_xxx',
  'dbpassword' => 'xxx',
  'installed' => true

The output of your Apache log:

[Mon Apr 08 17:28:00.416424 2019] [mpm_prefork:notice] [pid 3980] AH00169: caught SIGTERM, shutting down
[Mon Apr 08 17:28:00.576307 2019] [mpm_prefork:notice] [pid 17227] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Mon Apr 08 17:28:00.576399 2019] [core:notice] [pid 17227] AH00094: Command line: '/usr/sbin/apache2'

(In other words, no errors)

I’m still working on this issue, but I’m seeing suggestions elsewhere in the forums that there may be problems syncing from the Android app if you’re on a LAN. I am running my Nextcloud at home, over the LAN. It’s not public.

I was using http://tower/cloud as my local address. I added my IP as a trusted domain in the config, logged out of both my laptop and phone, and logged back in using http://192.168.1.x/cloud instead. This has not fixed the problem, though – it’s exactly the same as before.

Note that I’m not over SSL but like I said, I’m just using it at home.

This looks normal to me. The client maintains (downloads) the files in this folder.
I do not understand what you mean by “original file location”.

Be aware that clients on mobiles work differently than the desktop client. The desktop client maintains a mirror of the cloud files on your local storage. The mobile clients provide a sort of view on the cloud files, and you can fetch the files you want/need.

Thanks for the reply. I’m looking around the forums a little more, and it looks like there’s no way to do 2-way mirroring between desktop and Android using Nextcloud.

Like you said, it’s more of a file viewer on Android – Though, I will say, that when I use the notes app in Nexctloud and on Android, all my notes are always accessible, even when I’m offline.

Still, they’re not all available in the file system, even in the app’s media folder. I’ve tried going in there and editing the few existing files with another app, but Nextcloud won’t sync these changes. So there’s no hack that I can see do 2-way mirroring.

Frustrating, because both the developer of QOwnNotes (Ubuntu) and Markor (Android) both claim that Markor can be used to sync notes on Android, and this does not appear to be the case at all.

Nextcloud is a cloud, not a file mirroring program, even though the desktop client for Linux (and WIndows?) only implements mirroring. That is a ‘bug’ which will be ‘fixed’ with the upcoming virtual drive support.

When you download a cloud file in Android (to the app’s media folder) then the client should periodically (every 15 mins) check for server side changes and fetch the latest copy of the file. But this doesn’t seem to work on some Android devices.

Interesting. Well I think that kind of syncing is working fine. I wondered if there was mirroring happening that was less instantaneous – like every 15 minutes. But it sounds like you’re saying this only happens in the media folder. So if I update these files with a text editor, even if they’re in the media folder, this won’t propogate those changes.

However, if I edit them using the NextCloud app, or NextCloud notes, these changes will propogate to the server and mirror to my laptop. So I just need to get used to the apps, for now. Thanks for the clarification.