Quantcast
Viewing all articles
Browse latest Browse all 8068

listenig for activity lifecycle events

I have built a simple android native module for an appcelerator project. And in the index.js file of the app that will be using the module, i need to listen for the basic android lifecycle calls.. onPause, resume, create, start, etc.. I am not a JS developer and have found the documentation for appcelerator vague and just awful..

can someone please tell me how from the index.js file i can listen for the lifecycle events?

below is my current index.js of my titanium app but the listeners are not firing..

// TODO: write your module tests here
var cueserviceinterface = require('com.mypackage.sof');
Ti.API.info("module is => " + cueserviceinterface);
 
 
Ti.App.addEventListener('create', function(e){
    Ti.API.info("ON CREATE");
    cueserviceinterface.startForegroundService();
});
 
Ti.App.addEventListener('start', function(e){
    Ti.API.info("ON START");
});
 
Ti.App.addEventListener('resume', function(e){
    Ti.API.info("ON RESUME");
});
 
Ti.App.addEventListener('pause', function(e){
    Ti.API.info("ON PAUSE");
});
 
Ti.App.addEventListener('stop', function(e){
    Ti.API.info("ON STOP");
});
 
Ti.App.addEventListener('destroy', function(e){
    Ti.API.info("ON DESTROY");
});
 
 
function doClick(e) {
    $.label.text = "Service Started";
 
 
    //$.label.text = cueserviceinterface.getDefaultLauncher();  
}
 
 
function hideBar(e){
    cueserviceinterface.hideNotificationAlert();
}
 
function showBar(e){
    cueserviceinterface.showNotificationAlert();
}
 
function changeCorey(e){
    cueserviceinterface.setNowHelping("Corey A.");
}
 
function changeErik(e){
    cueserviceinterface.setNowHelping("Erik L.");
}
 
function showUPNext(e){
    cueserviceinterface.setUpNext("Jesus Christ");
}
function launchYouTube(e){
    cueserviceinterface.startNewIntent("com.google.android.youtube.HomeActivity","com.google.android.youtube");
}
function authenticate(e){
    cueserviceinterface.launchSettings();
}
$.index.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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