Last active
December 20, 2015 20:19
-
-
Save egomez99/6189841 to your computer and use it in GitHub Desktop.
Android Activity tracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create() { | |
Ti.API.info(" ### STATE: CREATE"); | |
} | |
function destroy() { | |
Ti.API.info(" ### STATE: DESTROY"); | |
} | |
function newintent() { | |
Ti.API.info(" ### STATE: NEW INTENT"); | |
} | |
function pause() { | |
Ti.API.info(" ### STATE: PAUSE"); | |
} | |
function resume() { | |
Ti.API.info(" ### STATE: RESUME"); | |
} | |
function start() { | |
Ti.API.info(" ### STATE: START"); | |
} | |
function stop() { | |
Ti.API.info(" ### STATE: STOP"); | |
} | |
function resumed() { | |
Ti.API.info(" ### STATE: RESUMED"); | |
} | |
Ti.Android.currentActivity.addEventListener("create", create); | |
Ti.Android.currentActivity.addEventListener("destroy", destroy); | |
Ti.Android.currentActivity.addEventListener("newintent", newintent); | |
Ti.Android.currentActivity.addEventListener("pause", pause); | |
Ti.Android.currentActivity.addEventListener("resume", resume); | |
Ti.Android.currentActivity.addEventListener("start", start); | |
Ti.Android.currentActivity.addEventListener("start", stop); | |
Ti.Android.currentActivity.addEventListener("resumed", resumed); | |
//Simple UI - my root window ... | |
var window = Ti.UI.createWindow({ | |
backgroundColor : 'red', | |
exitOnClose : true, | |
fullscreen : false ////Force HeavyWeight window ... | |
}); | |
window.addEventListener('open', function() { | |
Ti.API.info(' RED WINDOW OPENED'); | |
window.getActivity().addEventListener('pause', function(e) { | |
Ti.API.info(' RED WINDOW - PAUSED '); | |
}); | |
window.getActivity().addEventListener('resume', function(e) { | |
Ti.API.info(' RED WINDOW - RESUME '); | |
}); | |
}); | |
window.addEventListener('click', function() { | |
var object = require('window'); | |
var window2 = new object(); | |
window2.open(); | |
}); | |
window.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function object(){ | |
var window = Ti.UI.createWindow({ | |
backgroundColor: 'blue', | |
exitOnClose: false, | |
fullscreen: false//Force HeavyWeight window ... | |
}); | |
window.addEventListener('open', function(){ | |
Ti.API.info(' BLUE WINDOW OPENED'); | |
window.getActivity().addEventListener('pause', function(e){ | |
Ti.API.info(' BLUE WINDOW - PAUSED '); | |
}); | |
window.getActivity().addEventListener('resume', function(e){ | |
Ti.API.info(' BLUE WINDOW - RESUME '); | |
}); | |
}); | |
window.addEventListener('click', function(){ | |
Ti.API.info(' BLUE WINDOW CLOSED'); | |
}); | |
return window; | |
} | |
module.exports = object; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment