android-money-manager-ex icon indicating copy to clipboard operation
android-money-manager-ex copied to clipboard

Sync issue Google drive

Open ggraziotti opened this issue 10 months ago • 28 comments

1 Open a file on GDrive modify it and sync. After that sync date and hour on GDrive seems to be updated. 2 Open gdrive file on other device (the date/hour indicated on gdrive is the same that on first device) and file opened is older then point 1.

MMX version 2024.03.24 in both android 11 device

ggraziotti avatar Mar 25 '24 21:03 ggraziotti

hi @ggraziotti, can you show us your sync setting in the app?

guanlisheng avatar Mar 25 '24 23:03 guanlisheng

Screenshot_2024-03-26-19-47-58-30_56d4659ac84df734ec7538fc9956390c

ggraziotti avatar Mar 26 '24 18:03 ggraziotti

any other details, e.g. interval and detailed steps to produce the issue?

guanlisheng avatar Mar 27 '24 04:03 guanlisheng

5 minutes.

ggraziotti avatar Mar 28 '24 17:03 ggraziotti

hi @ggraziotti , thanks.

And detailed steps to reproduce the issue?

guanlisheng avatar Mar 29 '24 06:03 guanlisheng

Happens to me too. My 2 devices are Android 10 phone and Windows 10 Professional PC (using Google Drive Windows application). I have the option "sync on app start" on, or from the toast menu I manually select "Synchronize", or "Settings - Synchronization - Download", (what's the difference between the 2 menu commands anyway???) but Android doesn't update the db from the remote Drive which has been modified on Windows; The other way round seems to work (i.e., modify on Android, synchronize, open on Windows, the changes are there).

EDIT: app version is 2024.03.26 (1025) updated from F-Droid

splisp avatar Apr 01 '24 10:04 splisp

  1. Synchronize is to perform ad-hoc sync.
  2. while Synchronization provides more settings. (including force download and upload)

can you check whether the file is synced to google drive, e.g. via browser

guanlisheng avatar Apr 01 '24 12:04 guanlisheng

I think that the problem is when changes are limited to details of existing transactions. For example, a change of the status of an existing transaction from "none" to "reconciled" is not synced. I have never missed a new transaction added to the db between synchronization so far, but changes to existing transactions are often missed.

splisp avatar Apr 01 '24 12:04 splisp

that's weird. both are to modify the database file, and Google Drive should sync it. hence whether the file is synced in google is important.

for your case, can you verify by adding a new transaction?

guanlisheng avatar Apr 01 '24 12:04 guanlisheng

Here's a test I've done right now:

  1. Open db in WIndows, delete a transaction, then permanently delete the transaction also from the delete transactions folder.

  2. Close the Windows application

  3. Check the date / time in Google Drive from browser, it's been updated with the current time

  4. Open the Android app, which is set with "sync on start" on: the notification "the database is up to date" appears, but the deleted transactions is still shown

  5. From the toast menu in the Android app, select "Synchronize": again, the notification "the database is up to date" appears, but the deleted transactions is still shown

  6. From the toast menu in the Android app, select "Settings" -> "Synchronization" -> "Download": the database is finally synchronized, the deleted transaction is not there anymore also in the Android app.

Now, I wonder why "Download" and "Upload" are in the Settings menu, anyway - also, it seems that "Synchronize" does not work as it should.

splisp avatar Apr 01 '24 12:04 splisp

I still can't find a reproducible test scenario for the case of transaction status change. I notice anyway that the Android app calls the "unreconciled" status as "none", differently from the Windows desktop application. IMO it's worthy to have a consistent spelling between the two applications; I don' think this can be the cause of some bug in synchronization of the status of transactions, although there's a small possibility - isn't it?

splisp avatar Apr 01 '24 13:04 splisp

Thanks. it is very detailed.

"Download" and "Upload" in the Settings menu are for single direction op and it is force.

"Synchronize" will perform in either direction based on mtime. I suspect the mtime from Google Drive is not fetched correctly. may I have your Google Drive app version?

guanlisheng avatar Apr 01 '24 13:04 guanlisheng

I suspect the mtime from Google Drive is not fetched correctly. may I have your Google Drive app version?

I am using the Drive app from Google v 88.0.0 on WIndows, just reinstalled yesterday; my phone is on Android 10, maybe this is a more critical issue.

splisp avatar Apr 01 '24 13:04 splisp

I wanted to use Box as a cloud provider but Box recently dropped support for Android 10.

splisp avatar Apr 01 '24 13:04 splisp

i mean the Android Google Drive app version. this is the one interaction with MMEX app.

guanlisheng avatar Apr 01 '24 13:04 guanlisheng

i mean the Android Google Drive app version. this is the one interaction with MMEX app.

It's version 2.24.117.0.all.alldpi

splisp avatar Apr 01 '24 13:04 splisp

thanks. can you upgrade it (google drive) to v2.24.127.0? i see there are some bug fixes.

guanlisheng avatar Apr 01 '24 13:04 guanlisheng

No, the update is not offered... the last version I can see from Play Store is 117 (19 Mar 2024). BTW I have saved the logcat from MMEX (attached), maybe you can extract some useful information?

logcat.zip

splisp avatar Apr 01 '24 14:04 splisp

No, the update is not offered... the last version I can see from Play Store is 117 (19 Mar 2024). BTW I have saved the logcat from MMEX (attached), maybe you can extract some useful information?

logcat.zip

Before running the app, I had modified the db on Windows; then I just started the app, performed nothing and saved the logcat. Just a few seconds had passed.

I spotted the lines

04-01 15:50:18.811 20422 20491 D SyncService: local file has changes: false 04-01 15:50:18.811 20422 20491 D SyncService: Remote file has changes: false

They don't give much information on the process of finding the changed status of the local and (mainly!) the remote files... (the latter was changed)

splisp avatar Apr 01 '24 14:04 splisp

the result in logcat is the result instead of reason.

can you open your Google Drive app to see the database file's last modification time?

guanlisheng avatar Apr 01 '24 14:04 guanlisheng

I was just doing that check and I've found that if I just open the Google Drive app, before opening MMEX, then the synchronization happens. I only waited a couple of minutes, but independently of how much time passes between the change on the other device (Windows) and the opening on Android, the synchronization only realizes that there's a change in the remote file if I open the Drive app on my phone before opening MMEX.

splisp avatar Apr 01 '24 14:04 splisp

ok. i think this is reasonable

  • both desktop and android app are 100% relying on 3rd storage or service to perform the sync.
  • desktop use posix interface, i think the according google drive was running in your windows
  • android use SAF interface, it also expected google drive to fetch/sync the file (metadata at least)

this is documented in MMEX development arch, data, and user

guanlisheng avatar Apr 01 '24 14:04 guanlisheng

Yes, as a developer it seems reasonable to me too; but as an end user, it doesn't... knowing this workaround, I will continue using it, but I wouldn't suggest this app to a non-technical person. On the other hand, I have promoted the usage of Keepass2Android to all my family members, paired with KeePass2 on Windows and GoogleDrive; on Windows a plug-in has to be installed in order to have cloud access (an easy task), while on Android, GoogleDrive and a bunch of other clouds are supported internally by the app. I didn't investigate into the sources (it's here on GitHub) but I think it was a complex task.

splisp avatar Apr 01 '24 14:04 splisp

understood.

In theory, the Google Drive app/service would be called implicitly by MMEX. An explicit google drive app open is weird.

guanlisheng avatar Apr 01 '24 15:04 guanlisheng

I have tried opening Mixplorer, between an update on desktop and reopening on Android, instead of opening Google Drive. In Mixplorer I have added my Google Drive account, and it shows the latest modification date / time; still, it's not enough to have MMEX catch the latest mtime, I have to open just the Google Drive app.

splisp avatar Apr 01 '24 15:04 splisp

Oh, it might be a problem with Android 10. It would be nice to be able to make tests on different versions of OS and see if the issue can be related to Android 10. @ggraziotti is on Android 11... can you please check if opening the Drive app makes MMEX catch the synchronization?

splisp avatar Apr 01 '24 15:04 splisp

hi @pdelamotar, this is close to your scenario. can you share your android/google drive versions?

guanlisheng avatar Apr 02 '24 04:04 guanlisheng

My case

  • 2 devices: + Smartphone android 11, running google drive version 2.24.127.0.all.alldpi, mmex version 2024.03.26 (1025) + Tablet android 11, running google drive version 2.24.127.0.all.alldpi, mmex version 2024.03.26 (1025) Testing 1/ Open database on tablet, add transaction. Click "Synchronize". 2/ Check file status in google drive, it doesn't sync 3/ Open file from smartphone, nothing change. ---> Update 4/3/2024 9:37 pm Testing new rounds, synchronize progress works with database file opened from google drive. I'm testing with latest version of Google Drive, MMEX on my tablet and smartphone. Ensure your devices run lastest version of all apps, and go to "Synchronization" setting, enable "Sync enable". Then enjoy! Try it again with Google Drive, guys.

jkam007 avatar Apr 03 '24 04:04 jkam007

dup with #1702

guanlisheng avatar May 16 '24 15:05 guanlisheng