App has trouble waking up on Android ...?

You must Login before you can answer or comment on any questions.

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
};

— asked 3 years ago by Esben Maaløe
2 Comments
  • Kevin Whinnery - not Innery, sorry

    — commented 3 years ago by Esben Maaløe

  • using V8 and 1.8.1 - not 1.8

    — commented 3 years ago by Esben Maaløe

2 Answers

Accepted Answer

There is a known bug regarding this. TC-652

— answered 3 years ago by Stephen Feather
answer permalink
6 Comments
  • Looks like it was fixed for 1.8.2 release TIMOB-1911

    Looks like the patch went into SDK 1.8.2.v20120221114636 ( osx, windows)

    — commented 3 years ago by Stephen Feather

  • The behaviour when an error occurs seems to be the same as in that bug, but I don't have random (although some of my users already do :/ ) - I experience this when the app has been in the background ... I'll try to get 1.8.2 tho ... if only I could remember where to pull it :)

    — commented 3 years ago by Esben Maaløe

  • Linux

    — commented 3 years ago by Stephen Feather

  • Show 3 more comments

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!