- This topic has 7 replies, 3 voices, and was last updated 11 years, 1 month ago by Yann.
-
AuthorPosts
-
YannMemberHello,
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
support-octavioMemberHi 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
YannMemberHello Octavio
thanks for the link
my app run on IOS 7 (native app)
I’ll try with document.addEventListener(“pause”, onPause, false);
thanks
Yann
YannMember🙁
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
Yannphoneui.documentReadyHandler = function() { document.addEventListener("deviceready", onDeviceReady, false); } function onDeviceReady() { document.addEventListener('pause', onPause, false); } function onPause() { setInterval(getinformation,30000); }
support-michaelKeymasterIs 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.
YannMemberHello 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
support-michaelKeymaster>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.
YannMemberok i understood, it’s a very bad new
thanks -
AuthorPosts