33
Views
4
Comments
Send Binary data from mobile app to Back-end while returning online
Question

Hi,

What is the best practice for syncing data from a mobile app to a backend when you have a large number of binaries to sync ?

The scenario is the following : 

A mobile app must allow users to capture photos and videos while offline.

When the mobile app comes back online, it should send the offline data to the backend.

What would be the best approach : use the UploadFile action of the File Transfer plugin and in this case how to manage the sending of multiple files; or, as a second approach, trigger OfflineSyncData, retrieving image and video binaries via the File Plugin's GetFileData Action and using the default asynchronous data synchronization mechanism ?

Thank you in advance for your help on this subject.

Renaud

UserImage.jpg
Srinivas Prasad

Could you tell me whether you are saving offline video or photo in a table in Apps local storage ?

 

2024-02-22 23-38-31
Rahman Brussolo

Hi @Renaud Diez 

In my opinion, you have 3 possible scenarios:

 - one to many where multiple end users are not likely to change the same data applications are offline

https://success.outsystems.com/documentation/11/developing_an_application/use_data/offline/offline_data_sync_patterns/read/write_data_one_to_many/


 - with conflict detection where several users change several data

https://success.outsystems.com/documentation/11/developing_an_application/use_data/offline/offline_data_sync_patterns/read/write_data_with_conflict_detection/


 - or a simpler last recording date scenario

https://success.outsystems.com/documentation/11/developing_an_application/use_data/offline/offline_data_sync_patterns/read/write_data_last_write_wins/



link to the offline synchronization patterns page

https://success.outsystems.com/documentation/11/developing_an_application/use_data/offline/offline_data_sync_patterns/


UserImage.jpg
Renaud Diez

Thank you for your reply Rahman, but it didn't really help me as I was aware of theses techniques and documentation. But nevertheless, let me share my current experience on the matter in order to provide you more context.

First of all, and to clarify the case, the recorded videos cannot be done by multiple users for the same footage. But the recorded videos must be attached to other entities' records.

In our experiment what we've done, and discovered so far, is: 

We cannot benefit by default of the native offline data synchronization offered by the mobile app pattern as the maximum volume of data allowed is limited to 30Mb by sync, which is regularly the case for video footage. Another limitation of the native offline sync mechanism is the fact that large volume of data cannot be chunk in order to be sent more efficiently.

The only available option so far was to use the capabilities offered by the File Transfer Plugin in conjunction with the capabilities offered by the File Plugin.

Here is the followed implementation: 

  1. The video is recorded by the user via the Camera Plugin
  2. The video metadata is stored in the local database of the device
  3. The binary (HQ) of the video is copied via the File Plugin into a non-temporary folder of the device (in the other case, the binary could be deleted after a short period by the device system itself)
  4. If the device is online, or once it is back online, the metadata are transferred to server via the native offline mechanism
  5. If the device is online, the binary of the video is sent to the server via the File Transfer Plugin (the widget must be present on the video capture screen for this)
  6. If the device is offline and come back online later, so far, we've been obliged to inform the user that some data must be synchronized in order for the user to go on a dedicated page where he is able to launch the sync. This is the part we are trying to avoid as it is definitely not user friendly. 

The last step described above is actually used because the File Transfer Plugin didn't manage a full background sync mechanism, contrary to what we understand from reading the documentation.

In addition of all of this, for the moment in ODC, when the different plugins (Camera Plugin, File Transfer Plugin and File Plugin) co-exist, a critical issue arises at the first installation of an app. Indeed, the File Plugin, in this case, is not able to write properly on the device. In order to work correctly, the user must close the app and re-open it, then everything works as expected for iOS. For Android, it is another story ... to be continued

2018-11-07 02-41-33
André Dinis

Hi Renaud, 

I am very interested in your use case and your "to be continued", as I have a similar scenario to implement.

Do you have any updates on the solution you implemented? 

Best regards,

André Dinis

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.