1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    12
    Vote Rating
    0
    amitthakkar is on a distinguished road

      0  

    Default Unanswered: Sencha Touch Auto sync data to Server

    Unanswered: Sencha Touch Auto sync data to Server


    Hi,

    i have built a simple datadriven sencha app with auto sync support to a server api.
    i have build the auto sync using Delayed Task that keeps running every x minutes.

    As long as the app is running in the foreground the auto sync works fine. But once the app moves into background on Ipad, the auto sync stops.

    Can anyone point me in the right direction?

  2. #2
    Sencha User grgur's Avatar
    Join Date
    Aug 2007
    Location
    Split, Croatia
    Posts
    155
    Answers
    10
    Vote Rating
    24
    grgur has a spectacular aura about grgur has a spectacular aura about

      0  

    Default


    AFAIK, you can't run a JS app in the background unless you wrap it (e.g. Cordova/PhoneGap) and use a bit of native code. If you use Cordova, this bit of code will prevent your app from sleeping while in background:

    Code:
    [UIApplication sharedApplication].idleTimerDisabled = YES;
    Just make sure you don't abuse their battery and bandwidth. I sure wouldn't like that.
    Grgur Grisogono
    Ext JS in Action SE co-author
    Exercising awesomeness at Modus Create - Official Sencha Partner

    Get in touch for Sencha Touch Training
    @ggrgur

  3. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    12
    Vote Rating
    0
    amitthakkar is on a distinguished road

      0  

    Default


    Hi grgur,

    Thank you for the response, i apologize for reverting back so late.
    i tried your idea, but i think it's just not letting the ipad 'sleep' when the app is running.

    my requirement here is that when the app itself goes into the background, as in the user switches over to check his email or some other app on his Ipad. and the app should still be running in the background.

    i am running a repetitive delayed task to fire some ajax calls to sync data online to the servers.
    the task works fine till the app is in foreground, but once the user switches to the home screen or some other app, the sync stops.

    any ideas are appreciated. thank you .

Thread Participants: 1

Tags for this Thread