Good afternoon to all.
I have quite simple notes application and I want to make simple thing - on user's demand app should synchronize its "notes_db" file with version in cloud
(at first stage I want to synchronize the whole "notes_db" file, for simplification).
As I'm not skilled enough yet to write my own web-server with its API, it was decided to use DropBox Sync API for my purposes.
At this moment I've successfully implemented user authorization in my app.
And I supposed, that I will indicate "notes_db" file and say "Sync this file!" to Sync API - and this file will be synced to cloud.
But it isn't so easy for me now :-(.
My first question is - do I understand correct, that I'm not able to sync specific file that I want to sync (in my case, this is file located at "/databases/notes_db") via DropBox Sync API?
And the second question - what should be mechanism of synchronization in that case?
My guess is that I should do next
(I guess that I will have 3 versions of "notes_db" file - local (where my app will make changes), local cache and cloud version):
1) create empty file "notes_db" in DropBox filesystem (if I understand right, it will create both local cache and cloud versions) or try to open it, if it exists;
2) transfer contents of local version to just created local cache version;
3) call some methods (which?) to syncronize changes from local cache to cloud version.
Then, on next synchronization call:
1) compare files - cloud, local cache and local versions;
2) if local version is the newest one - transfer its contents to local cache version and start synchro;
3) if cloud version is the newest one - get it in local cache and transfer its contents to local version of file.
In addition - after creating DropBox filesystem, which methods should I call? hasSynced(), listFolder(), awaitFirstSync(), syncNowAndWait(), getSyncStatus()?
Saying honestly, I'm totally confused with it now.
Or may be there is a simplier way to solve my issue - no matter, via DropBox Sync API or in some other way?
If someone can provide useful tutorial or working example with synchronization of one file - I would be very grateful for that.
And thanks for any help!
This question is really important for me now.