I am a joplin user. Plan to make a patch to let joplin do background sync in android. I plan to use HeadlessJS of React Native to achive this purpose. The code size will be quite big.
Per guild in source, I need to start discussion in this forum. So I created this topic. If you have any question about it, please ask it.
I don't know there are previous attempts at all. Would you mind help to provide some info about previous attempts? I guess this info is hidden in some place and simply googling is not able to find it.
After some researching, I am interesting on existing solution provide by @camgraff. Basicly, we use same underly tech: HeadlessJS. The difference is that he uses react-native-background-fetch and my plan is to use headlessjs directly + java code to handle background.
There is a difference is that he aims for android/ios together. And I only works for android. By using native java code, I believe I can achieve the state of art in background sync which I mean I can make background sync as good as other app ( none google app ).
I think this might be a problem in itself, we would want a solution that works for all platforms and wouldn't want to split functionality by OS unless it is literally impossible to do so on that platform.
I am understanding your consent. But let me be honest, you can hardly to find a person can handle both andorid and ios at same time. If you are only interested in total solution, I think you'd wait more time than you expected.
For me, it is ok. I am android user and developer, so I am satisfied with android solution only and willing to spend some time on it. I am writing this post because I hope I can contribute it back to community. However, if it is not possible, I am ok with it.
I would have to defer to the experts here, it is quite common we get people proposing fixes for things that only target one platform and quite often the answer is that we would prefer to wait for a complete solution than doing half of it.
I'll leave anything else for comment by people who know more about the subject than I do.
How do you manage to trigger sync in the background? Does your native code somehow calls the js sync code?
As Daeraxa mentioned we generally prefer cross-platform solutions but there's so much demand for this feature that we'd consider it if it's well implemented and reliable.
I think current native code in my branch, you can't disable background trigger because it is just a prototype. In finaly PR, I can add a native method to turn off background sync.
Although you can forbid in js code which means even native code trigger sync however it will be bannded due to some js level restriction.
In android, as I understand, there is no such concept "quit the app". The lifecycle is manager by system/os not by app itself. However, for your question, I think when in settings UI, user choose no auto sync then js code can call the native module method to stop the app be triggerred future in background by andorid.
This is a must have feature. After opening joplin I have to wait about an hour before sync completes. I don't use the android app often and it has to sync a lot of files.