facebook

documentReadyHandler works in sim. but not in mobile: CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #347783 Reply

    mobio9471
    Member

    Hi,

    I develop an app using mobione and have some JavaScript code implemented to phoneui.documentReadyHandler for initializing purposes. Everything works fine. Including the Simulation on web simulator (Android 2.3.2). But when I build the app and install it to my mobile (Samsung SII Android 2.3) it seems to me, that phoneui.documentReadyHandler is not invoked at app-startup. Because no initialization happens. The app-functionality is completely available. There are some functions invoked inside AND outside phoneui.documentReadyHandler. The outside invokations perform correctly. But there are no invokations inside .

    Any suggestions ?

    #347785 Reply

    Brandon
    Member

    Have you tried placing it inside the custom.js file documentready function to see if it is called there?

    #347788 Reply

    mobio9471
    Member

    phoneui.documentReadyHandler is located inside <name>_custom.js . The code for initialization is located inside the handler function. In simulation the code works well, but in the mobile it looks like the code doesn’t .
    Any idea what the problem is ?

    #347789 Reply

    Brandon
    Member

    I know a lot of people dont like to post their code. But its hard without seeing code to trouble shoot problems.
    My first step would be to verify your code doesnt contain any errors. If you dont want to post it use this to check it:

    http://jslint.com/

    If you can post it it may help to find the problem (providing the forum lets you post it…)

    #347897 Reply

    mobio9471
    Member

    Hi Brandon,

    thank you very much for your reply.

    >I know a lot of people dont like to post their code. But its hard without seeing code to trouble shoot problems

    You are right, but I don’t want you to do the work for me, I am glad if you help me to overcome my limits and give me the ideas I never would get on my own because of the lack of experience.

    So I decided to make a new attempt to find the problem before to post the code.

    I followed the link that you posted. I got the idea from it, that there could be something wrong with the availability/accessability of the js code.

    I simplified my problem and put only a text field to my startup screen. I tried to change the content on startup by jQuery statement like this

    /**
    * Called when document is loaded.
    */
    phoneui.documentReadyHandler = function() {
    $(“#m1-test-text1”).text(“newContent”);
    }

    Nothing happened.

    I remembered that I some time before did rename the startup screen from AppName.mobi to appName.mobi via windows file explorer. After building the App again, all files also renamed except AppName_custom.js and AppName.json. I renamed them manually.

    The result of this action was that everything even the js code (eg. button action handlers, other functions etc) worked as expected …

    .. except the code inside

    phoneui.documentReadyHandler = function() { }

    So I decided to make the startup screen from scratch.

    Now everything works as expected.

    Including the code inside
    phoneui.documentReadyHandler = function() { }

    From my point of view the renaming action may have caused the problem.

    Does there exist any (official) alternative to rename the screen.name to avoid this problem ?

    #347905 Reply

    Hi mobio9471,

    >Does there exist any (official) alternative to rename the screen.name to avoid this problem ?
    You can rename the old custom js file and move it to the new generated www folder location to match the new startup file.

    #347979 Reply

    mobio9471
    Member

    Hi octavio,

    That means, renaming by creating a new .mobi file build it and copying the related files.
    thank you very much for you reply !

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: documentReadyHandler works in sim. but not in mobile: CLOSED

You must be logged in to post in the forum log in