Hi!
I've got an android app out on the market: https://market.android.com/details?id=dk.miracleas.appchoir.mow.mmxii
All windows are created as CommonJS modules
The problem is that when the app has been in the background for a while, it becomes very difficult to resume it. I get a black non-responsive screen and after a good deal of time the 'not responding, should I kill or wait?' message appears. However it seems like you have to provoke it by clicking the 'back' button, otherwise nothing at all seems to happen.
When I choose 'kill' only the window that is hanging seems to be killed, or rather closed, and I'm taken to the previous window in the window stack - that window is black as well, and I can keep on doing this until the window stack is emptied (click back and wait for a loong time until the kill msg appears). If the window stack is 4-5 windows deep, this becomes a very lengthy and very annoying thing. I'm really baffled that the app is not killed by Android, but maybe I am misunderstanding what is going on? However the no. of times you have to do the kill thing seems to correspond with the size of the windows stack.
Finally, the app can be started and function normally again - until it has been in the background for a while of course.
I'm using Kevin Innerys 'navigation_control' that I had to modify, it doesn't seem to work with SDK 1.8. So this is my modified version of Kev's navigation_controller.js
There is no secrets in the code of my app, and I've uploaded it here: http://dl.dropbox.com/u/776614/Resources.zip
If anyone would take a peek and maybe clue me in on what is wrong should definitely do so, any advice is very welcome. This project is the official android app for a convention hosted by my company, and if the app doesn't do well, it might very well be the end of Titanium as dev-tool in my company.
/** * by Kevin Innery * from https://github.com/appcelerator-developer-relations/Forging-Titanium/tree/master/ep-002/Resources *THIS IS A MODIFIED VERSION * Instantiate: * var NavigationController = require('NavigationController').NavigationController, */ exports.windowStack = []; exports.NavigationController = function() { }; exports.open = function(/*Ti.UI.Window*/windowToOpen) { //add the window to the stack of windows managed by the controller exports.windowStack.push(windowToOpen); //grab a copy of the current nav controller for use in the callback var that = exports; windowToOpen.addEventListener('close', function(e) { that.windowStack.pop(); }); //hack - setting exports property ensures the window is "heavyweight" (associated with an Android activity) windowToOpen.navBarHidden = windowToOpen.navBarHidden || false; //exports is the first window if(exports.windowStack.length === 1) { if(Ti.Platform.osname === 'android') { windowToOpen.exitOnClose = true; windowToOpen.open(); } else { exports.navGroup = Ti.UI.iPhone.createNavigationGroup( { window : windowToOpen }); var containerWindow = Ti.UI.createWindow(); containerWindow.add(exports.navGroup); containerWindow.open(); } } //All subsequent windows else { if(Ti.Platform.osname === 'android') { windowToOpen.open(); } else { exports.navGroup.open(windowToOpen); } } }; //go back to the initial window of the NavigationController exports.NavigationController.prototype.home = function() { //store a copy of all the current windows on the stack var windows = exports.windowStack.concat([]); for(var i = 1, l = windows.length; i < l; i++) { // (exports.navGroup) ? exports.navGroup.close(windows[i]) : windows[i].close(); } exports.windowStack = [exports.windowStack[0]]; //reset stack };
2 Answers
Accepted Answer
There is a known bug regarding this. TC-652
ah - you gave me the link. I'm on Linux tho ... I'll try it anyway
Your Answer
Think you can help? Login to answer this question!