Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: File Sync Mobile App  (Read 7704 times)
Stefan S.
Posts: 90

« on: August 15, 2017, 11:43:59 am »


for a new Mobile Project I am looking for  a way to sync Files between Mobile-Device and Server within a backgroud Process

The sync-Process should start without any user Action on the Mobile Device.
So I create some files on the device and if there is a internet connetion these files should send to the server.

I did something like that with "OwnCloud" but this is not really what I want to do now, because I don't want to install
any additional Software.

On Server side I have a running GAS.
So I can use a http WebService or I can use "runOnServer" on the mobile Device.

But what is the best way to run this in Background on the mobile Device?
Have I to use "on idle" or "on timer"

Has anyone did something like that before?

Any help is welome.

Kind regard

Stefan S.
Reuben B.
Four Js
Posts: 1071

« Reply #1 on: August 15, 2017, 02:09:28 pm »

But what is the best way to run this in Background on the mobile Device?
I would like to be proven wrong, but my understanding is that what you are after, running in the background on the mobile device can't be done.  The reason being that the Genero Mobile application is effectively single threaded and so whilst the fglrun process is handing the GUI side of the app, you can't have another fglrun process running in the background doing the file transfer.

Note: how RUN is listed in the limitations.   

So this means you can't have something like this to sync silently every 60 seconds...

  1. ON TIMER 60
  2.   -- Every 60 seconds upload/download data if necessary
  3.   RUN "export FGLGUI=0; fglrun background_sync"

This is how I figure most news apps work.  Periodically check to see if any new articles and if so download them in the background whilst you continue to read the current article.

With this limitation you are pushed down the path of having an explicit action to manage the sync e.g.

  1. ON ACTION sync
  2.   CALL sync() -- upload/download data via web-service

... and the user having started the sync has to wait for the sync to finish.

I have wondered in the past if you could do something like this ...

  1. ON IDLE 1 -- or ON TIMER 1
  2.   CALL tiny_sync() -- upload/download small amount of data via web-service

... where the API you are using is responsible for making sure each transmission is very small, small enough so that it does not interrupt the users UI experience (less than a second).  So you would have to split files into small sizes, send each piece individually, and join them back together at the other end.  How small depends on your network capability.  I have not tried to implement this concept to see if it can practically be done.


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of
Contributor to
Leo S.
Four Js
Posts: 126

« Reply #2 on: August 15, 2017, 10:57:13 pm »

Hi Stefan, currently I can't recommend an "out of the box" solution.
The most promising path are the upcoming Cordova Plugin integration tools and all cordova plugins which offer "background" upload/download capabilities.
Namely this plugin
and this plugin
are plugins dealing under IOS with the "NSURLSession" API
which ensures upload/download "out of process" by the system networking daemon.

So regardless if your GMI process is in the foreground or background using this API ensures that uploads/downloads continue.

I can't estimate if on Android the same happens (need to ask my GMA colleague)
For the download plugin I already made a sample for GMI 1.30.06
(Are you in the 3.10 Genero-EAP ?)  downloadable from
For the upload I need to check if the upload plugin is already usable in GMI.

If none of the plugins are fitting your purpose then there is also the possibility adding a custom frontcall in GMI/GMA using the appropriate system APIs . This could be done already for the released GM 1.20.

I can only warn to use 

to do networks syncs.

1. this will make you unhappy because  this needs to be implanted in each possible DIALOG the user enters and will hence lead to code pollution.
2. If you are in INPUT statements you may run into focus and validation issues
(reminder: ON IDLE flushes the current field, if you are in an INTEGER field and type accidentally "a" then you get an unwanted validation error and your  end users will be irritated)
3. It won't work anyway if your app is a longer time in the background (at least on IOS).

As mentioned my comments are pretty IOS centric, but I guess the Android answer will be similar
Regards, Leo

Pages: [1]
  Reply  |  Print  
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines