facebook

Question about Setinterval: CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #343866 Reply

    Yann
    Member

    Hello,
    In my app i get from a remote server some informations, i use
    setinterval(myfunction,20000);
    If my app is open but not foreground, setinterval do not run.
    do you have a solution to launch js function when app is not in foreground (but open)?
    thanks

    #343867 Reply

    Hi Yann,

    What is the runtime environment: ios/android, what device? please share model and OS.

    MobiOne apps only run in the foreground. The cordova/phonegap life-cycle events are available to detect when the app is suspended and resumed: http://docs.phonegap.com/en/2.9.0/cordova_events_events.md.html#Events

    #343869 Reply

    Yann
    Member

    Hello Octavio
    thanks for the link
    my app run on IOS 7 (native app)
    I’ll try with document.addEventListener(“pause”, onPause, false);
    thanks
    Yann

    #343870 Reply

    Yann
    Member

    🙁
    This code run as well in MobiOne Mobile simulator but not in my iphone 5 ios 7.03 compiled in native mode
    any idea?
    thanks
    Yann

    
    phoneui.documentReadyHandler = function() {
    document.addEventListener("deviceready", onDeviceReady, false);
    }
    function onDeviceReady()
    {
     document.addEventListener('pause', onPause, false);
    }
    
    function onPause() {
       setInterval(getinformation,30000);
    }
    
    
    
    #343874 Reply

    support-michael
    Keymaster

    Is the issue that your onPause() function is not called or the setInterval function never calls back to its getInformation function?

    If it is the latter that is simply due to application is suspended including the javascript engine when it paused.

    #343881 Reply

    Yann
    Member

    Hello Wayne
    Good question, i don’t know because never happen on my iPhone.
    i tried to play a sound in onPause() but nothing happen too.
    have you an example of function called when app is in background?
    thanks
    Yann

    #343883 Reply

    support-michael
    Keymaster

    >have you an example of function called when app is in background?

    No, I have shared with you already that background apps are not supported. There is no action that your app can perform once it is paused. We shared the lifecycle events with you as basic info for preparing your app to be paused.

    #343898 Reply

    Yann
    Member

    ok i understood, it’s a very bad new
    thanks

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Question about Setinterval: CLOSED

You must be logged in to post in the forum log in