Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Loop crash after 2:30 minutes

$
0
0

Hi !

I use the background refresh for doing a loop with local notfifications every 10 secondes. During 2-3 minutes it works, but after the loop crash.

in alloy.js

Titanium.App.iOS.setMinimumBackgroundFetchInterval(10);
// App is paused
Ti.App.addEventListener("pause", function() {
    var service = Ti.App.iOS.registerBackgroundService({
        url : 'js/bg-service.js'
    });
});
in bg-service.js
function setTimer(timetowait, context) {
    mt = 0;
        mtimer = setInterval(function() {
            mt++;
 
            if (mt == timetowait) {
 
                clearInterval(mtimer);
                Ti.App.fireEvent(context);
                getCurrentPos();
 
                setTimer(10, 'loopTimer');
            }
        }, 1000);
};
 
setTimer(10, 'loopTimer');

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>