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

localNotification listener – how it is available in all parts of app?

$
0
0

Hi folks,

I'm using Ben Bahrenburgs localnotification module to start a timer. The alert (and sound) should appear in all parts of app and if the app is in background. Background works.

If I embed the listener code in app.js, then it doesn't work in all parts. Now I have embed 'require labortimer') in all modules. On console I can see, in all parts the text 'HooHoo' appears, but the alert doesn't work everywhere.

if (Ti.Platform.name == "iPhone OS") {
    setInterval(function() {
        console.log('Hoohoo');
    }, 1000);
    Ti.App.iOS.addEventListener('notification', function(_e) {
        alert('TEST');   // and sound code
}
var LaborTimer = function() {
    /*Initialization: */
};
LaborTimer.prototype = {
    /* some methods */
};
module.exports = LaborTimer;
Any idea to solve it? How is the right way to embed global event listener?

Viewing all articles
Browse latest Browse all 8068

Trending Articles