Before setting out my goal, I would like to draw attention to how synchronization works in Syncthing Android example:
- On the local device (LD) in DeviceActivity, the remote device ID (RD)
- The event onDeviceRejected is processed by the EventProcessor on RD - Notification is generated and the DeviceActivity is started via PendingIntent, then the Device is created equivalent to LD
- The FolderActivity is started on the RD and the Folder associated with the LD is created.
- The event onFolderRejected is processed on the LD through EventProcessor - Notification is generated and through FolderActivity the FolderActivity is started via PendingIntent, then the Folder associated with the RD is created
After that, the folders created on LD and RD are perfectly synchronized.
Now about my purpose and the essence of my question. I do not need to create a Folder through FolderActivity, because the Folder properties are not entered from the UI, but are formed from the code and are known in advance. Therefore, the order of actions is as follows:
- On the local device (LD) in DeviceActivity, the remote device ID (RD)
- The event onDeviceRejected is processed by the EventProcessor on RD - Notification is generated and the DeviceActivity is started via PendingIntent, then the Device is created equivalent to LD
- On the RD from the code
Folder mFolder = new Folder ();
mFolder.id = generateRandomFolderId ();
mFolder.path = --- Local Folder Path ---;
mFolder.label = deviceID;
mFolder.fsWatcherEnabled = true;
mFolder.fsWatcherDelayS = 10;
mFolder.rescanIntervalS = 3600;
mFolder.paused = false;
mFolder.type = Constants.FOLDER_TYPE_SEND_RECEIVE;
mFolder.versioning = new Folder.Versioning ();
mFolder.addDevice (--- deviceID of LD--);
mFolder.order = "oldestFirst";
getApi (). createFolder (mFolder);
creates a Folder associated with LD
- If the event onFolderRejected is processed on LD, Notification is generated and FolderActivity is started via PendingIntent, then the Folder associated with the RD is created - FOLDERS SYNCHRONIZATION WORKS If, on the onDeviceRejected EventProcessor handler, you create a Folder from the code described above - FOLDERS DO NOT SYNCHRONIZE.
How can I implement the creation of a Folder from the code so that they are successfully synchronized?