moneymanagerex / android-money-manager-ex

Manage your finances on-the-go, encrypted for security, and sync via your cloud
http://android.moneymanagerex.org/
GNU General Public License v3.0
485 stars 187 forks source link

Syncing via Dropbox does not work between Android devices #1717

Open bgvr0607 opened 3 months ago

bgvr0607 commented 3 months ago

Describe the bug I tested syncing between two android devices. On both phones the same dropbox account is logged in and the same file is opened directly in dropbox. When I add a transaction on mobile 1 and press synchronize in the app, the change is immediately visible in Dropbox (confirmed by time stamp). After confirming this I tried to sync the database on mobile 2, which seemed to work because there was a success message. But the new transaction was not visible. Also re-opening the database on mobile 2 did not change anything.

While testing, I played around with entering transactions of mobile 1 and 2. To see which version of the database was actually being synced I opend the database using the Desktop app. When I tried that the following message appeared.

image

Is it possible that the database stays marked as opened by one of the devices and that messes up the sync? E.g. database does not sync, but app still shows successful sync

To Reproduce Steps to reproduce the behavior: 1) place database in dropbox folder 2) on both mobiles log into the same dropbox account 3) open the same database on both mobile phones 4) add a transaction using mobile 1 and press sync menu 5) confirm database is updated in dropbox 6) with mobile 2 try sync of database and check if transaction is visible

Expected behavior If the database is edited on one device and successfully synced, it should also be updated on the 2nd device upon opening the app (if sync on startup is enabled) or after pressing sync.

Device Information: Device: OnePlus 8T + Samsung Galaxy Note 10 Lite OS: OxygenOS 14.0 (Android 14) + One UI 5.1 (Android 13) Storage: Sync to Dropbox Encrypted: No App Version: 2024.06.14(1033)

guanlisheng commented 3 months ago

hi @bgvr0607, thanks for trying mmex.

In mobile 2, can you

  1. share the synchronization config
  2. check the timestamp
  3. manually sync by tapping synchronize.
  4. if still not working, 三 -> Settings -> Synchronization -> Download might help as it will download it once-time.
bgvr0607 commented 3 months ago

hi @guanlisheng guanlisheng, thank you for your quick response.

1) here you go: WhatsApp Bild 2024-06-15 um 18 39 57_b2203cb3 2) I checked the timestamps of the databases (...\Android\data\com.money.manager.ex\files\databases)

guanlisheng commented 3 months ago

Regarding timestamps, please check the file in the Dropbox App on both devices.

bgvr0607 commented 3 months ago

hi @guanlisheng. Thank you for your efforts. Sorry, I misunderstood your comment about timestamps. Thinking about the problem more, I tested the following scenario. In order to exclude a problem with one of the mobiles I tried this approach in both directions (same flow a second time, but this time start with mobile 2 to add a transaction) with the same results.

  1. uninstall money manager on both mobiles
  2. make sure dropbox shows the same timestamps for the database on both mobiles
  3. re-install money manager on both devices
  4. open database from dropbox on both devices
  5. confirm that both show the same content
  6. use mobile 1 to add transaction
  7. tap sync - success message
  8. new time stamp shows up in dropbox everywhere (mobile 1, mobile 2 and confirmed indenpently with PC)
  9. tapping sync mobile 2 shows message downloaded xxx bytes, but new transaction is not visible in mobile 2
  10. open database new in mobile 2 (when selecting the file from dropbox the correct timestamp is shown), but transaction is not shown
  11. settings>sync>download from cloud - message downloaded xxx bytes, but new transation not visible in mobile 2
  12. add another transaction using mobile 1
  13. new time stamp shows up in dropbox (mobile 1, mobile 2 and confirmed indepently with PC)

For me it looks like once one mobile starts editing the other cannot see any changes. But for the mobile that started the editing everything works as expected.

guanlisheng commented 3 months ago

thanks @bgvr0607, it is very detailed, and every step is good and we should see the transactions on both mobiles (just like step 5 in your step)

we try to reproduce the issue.

guanlisheng commented 3 months ago

so far, we can't reproduce the issue. may i have your dropbox version(s)?

bgvr0607 commented 3 months ago

mobile 1: 380.2.2 mobile 2: 380.2.2

If I can help you by testing something else, please let me know.

guanlisheng commented 3 months ago

one more test might help.

can you use mobile 2 to add a transaction and to see whether it is synced to mobile 1 correctly?

bgvr0607 commented 3 months ago

I already tried that to make sure it is not related to a specific phone. The result was the same.

guanlisheng commented 3 months ago

can you reinstall the app on device 2?

in issue #1638, one user mentioned an extra-open google drive/dropbox client might be required to sync the data from its server to end device, can you have a try too.

bgvr0607 commented 3 months ago

hi @guanlisheng, here is what I tested today. Sorry for the long post.

I assume you meant #1638, right? The issue #638 does not seem related.

I wanted to make sure the database is not the root cause, so I repeated some steps with a new database.

To see if the files on dropbox are really the same, I tried the following:

Next I tried the following:

How is the database in the folder .\Android\data\com.money.manager.ex\files\databases used in the syncing process? It seems this file does not get updated properly during syncing.

When playing around with the folder .\Android\data\com.money.manager.ex\files\databases I noticed the following behavior:

guanlisheng commented 3 months ago

.\Android\data\com.money.manager.ex\files\databases is a cache as Google Android does not allow direct access to external/remote storage (e.g. Phone's Document). it is a workaround to access them via SAF (Storage Access Framework).

MMEX app's synchronization is to sync between the external/remote and the cache. then external/remote will take care of sync itself via the cloud provider app. the entire workflow is verified.

it seems your devices were rooted.

guanlisheng commented 3 months ago

can you create a new database using PC in Dropbox and open it from from your device(s) ?

guanlisheng commented 3 months ago

additionally, I am wondering whether you can help verify it through other public/private cloud service providers, e.g. google Driver, oneDriver?

bgvr0607 commented 3 months ago

Thank you for the explanation. Both devices are not rooted.

Test with database created via Desktop App

Test using google drive:

During my tests I noticed that google drive takes longer to sync changes between devices. On the mobiles I always had to manually update the content in the app by swiping down. Is there any way to force an immediate update, otherwise the risk is high that if one user forgets to update the google drive content the database content is mixed up.

bgvr0607 commented 3 months ago

Also, I just remembered something. In the past the android app would give a warning during sync if something was about to be overwritten.

Now when pressing sync older versions simply get overwritten, in some of my tests transactions were therefore lost. Is this intended? Ideally the old behavior could be restored as then the users can check and merge the content manually.

guanlisheng commented 3 months ago

thanks @bgvr0607, very detailed. will continue looking into the dropbox issue, maybe some settings either in the code side or the app side may help.

in terms of conflict, it is file level and still exists today. refer to https://forum.moneymanagerex.org/viewtopic.php?p=24565#p24565

dustXman commented 2 months ago

Hi, I might have the same issue. I want to use MMEX with my wife to track some expenses. Both of us use Android. Both of us have fairly recent Samsung Mobiles. We want to ensure both of us can add expenses without dealing with synchronization once properly set up. We use "Hi Drive" Cloud store as Webdav storage.

We were able to also lose some transactions during synchronization. One file has some locally added transactions removed by pressing "Download" under Settings > Synchronization.

guanlisheng commented 2 months ago

hi @dustXman, thanks for trying mmex and its synchronization.

Hi Drive is a public cloud storage, your "issue" is different from the Dropbox. anyway, you can always refer to https://moneymanagerex.org/blog/mmex-cloud-storage-with-nextcloud/.

"Download" is to overwrite the local copy by downloading it from your cloud storage.
三 -> synchroize might be something you wanted..

dustXman commented 2 months ago

hi @dustXman, thanks for trying mmex and its synchronization.

Hi Drive is a public cloud storage, your "issue" is different from the Dropbox. anyway, you can always refer to https://moneymanagerex.org/blog/mmex-cloud-storage-with-nextcloud/.

"Download" is to overwrite the local copy by downloading it from your cloud storage. 三 -> synchroize might be something you wanted..

Well, If we use only "Synchronize" we get the expected responses when writing to the Cloud/HiDrive-File: Database already up to date or Database updated successfully on local changes. We also see file changes as we Synchronize new/deleted entries. However I can't see changes my wife made and vice versa...

guanlisheng commented 2 months ago

ok. "Download" behavior is expected.

Regarding sync issues, can you share some detailed configurations on both phones? I believe you already followed the guide but I wanted to double-check.

dustXman commented 2 months ago

What configuration details do you need? We have the same "remote path" on our HiDrive. I got an error when trying to create it on HiDrive right away. So I created it locally and synched it later (I might just copy it to the drive and open it again - not sure). My wife directly opened it from the cloud drive. Screenshot_20240710_070521_Money Manager Ex

What I just found out: Re-Open the database from the cloud reveals all the missed entries. So we can work with MMEX until this bug is fixed ;)

guanlisheng commented 2 months ago

At least your MMEX version... great if you provide similar context to what other reporters did in this GitHub issue.

I am unsure if this is a bug or a misconfiguration from either HiDrive or MMEX.

dustXman commented 2 months ago

MMEX version is 2024.07.04 (1035). Which parts of the previous mentioned ideas do you want me to repeat?

guanlisheng commented 2 months ago

i believe the first comment would be a good example to reproduce the issue. it is not to repeat, it is to provide the context to address the problem.

BoubouleThai commented 2 weeks ago

Hello I have the same problem of synchronisation. From phone 1, it works good to export the new transaction. I can see a new time in the export Dropbox file. If I open Moneymmx on the PC the new transaction will appears. If I open on phone 2 I have the message of synchronisation but I cannot see the new transactions. If in the menu I choose download manually I have a success message but.... no new transaction.

Also If I add new transaction on the PC, same problem. No automatic sync, no manually sync.

The only way that I found to sync is to change the name of the file after new transactions and on the phone to use "open a database" and open the new named file Not really a synchronisation 😉😉

guanlisheng commented 2 weeks ago

hi @BoubouleThai

manual sync will be like

  1. phone 1 add a new transaction
  2. phone 1: Upload (manually to the cloud storage)
  3. phone 2: Download (manually download from the cloud storage)
  4. phone 2: would show the new transaction from phone 1.

auto sync is just to perform the above steps periodlly. can you help another check?

BoubouleThai commented 2 weeks ago

Hi,

I added a new transaction Upload manually (settings>sync>upload) (the name of the file updated with new time date appeared)

Download on phone 2 (settings>sync>download) I have a pop-up "copied xxxxx bytes" BUT No new transaction seen

Also open manually the file (open database) ... no new transaction

Then Delete all the data of mmx in the phone>settings>app Then open the file: still no new transaction!

Then I only change the name of the file. The first one was 10-09, and I changed the name to 10.09a. Open the "new" database... and I can see the new transaction! 😊

Le mar. 10 sept. 2024, 08:42, Lisheng Guan @.***> a écrit :

hi @BoubouleThai https://github.com/BoubouleThai

manual sync will be like

  1. phone 1 add a new transaction
  2. phone 1: Upload (manually to the cloud storage)
  3. phone 2: Download (manually download from the cloud storage)
  4. phone 2: would show the new transaction from phone 1.

auto sync is just to perform the above steps periodlly. can you help another check?

— Reply to this email directly, view it on GitHub https://github.com/moneymanagerex/android-money-manager-ex/issues/1717#issuecomment-2339798076, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4SIW54MNEKLYXVYVIEJY6LZV2ID7AVCNFSM6AAAAABJLYRAKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZG44TQMBXGY . You are receiving this because you were mentioned.Message ID: @.*** com>

guanlisheng commented 2 weeks ago

ok, seems the Dropbox app has some issues with support SAF.

did you try with Google Drive, it should be good

BoubouleThai commented 2 weeks ago

I will try and tell you.

Le mar. 10 sept. 2024, 16:08, Lisheng Guan @.***> a écrit :

ok, seems the Dropbox app has some issues with support SAF.

did you try with Google Drive, it should be good

— Reply to this email directly, view it on GitHub https://github.com/moneymanagerex/android-money-manager-ex/issues/1717#issuecomment-2340929681, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4SIW55EA22CB7DBD6ZABRTZV34NJAVCNFSM6AAAAABJLYRAKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBQHEZDSNRYGE . You are receiving this because you were mentioned.Message ID: @.*** com>

BoubouleThai commented 2 weeks ago

I made some tries with google drive It works better but :

Le mar. 10 sept. 2024 à 16:08, Lisheng Guan @.***> a écrit :

ok, seems the Dropbox app has some issues with support SAF.

did you try with Google Drive, it should be good

— Reply to this email directly, view it on GitHub https://github.com/moneymanagerex/android-money-manager-ex/issues/1717#issuecomment-2340929681, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4SIW55EA22CB7DBD6ZABRTZV34NJAVCNFSM6AAAAABJLYRAKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBQHEZDSNRYGE . You are receiving this because you were mentioned.Message ID: @.*** com>