Easier Titanium Mobile Development with Remote Webview

Today, this weekend, I am playing Titanium Mobile Development.

Normally, when I am developing apps locally, whenever I change the code, I need to re-run the apps by hitting the Run button and wait for 10 to 20 seconds or more to test the apps. If I am designing the layout, whenever I adjust the figures or values of the design properties, I need to wait “so much time” in order to test it.

But today I found a faster way to test it. I am able to code the Titanium JavaScript inside a HTML file and uploaded to my web server. And then I had a Titanium Mobile native apps that contains a WebView which will request and download the HTML file and execute it. I stored the main Titanium JavaScript code inside a code block I custom defined in HTML, and then transfer the JavaScript code to Titanium Mobile native apps handler through Titanium.App.fireEvent method. Now, when I changed a tiny part of code I just need to save it to web server, and hit the Reload button on my iPhone device or simulator, it will re-download the JavaScript code and then compile and execute it in runtime.

Finally, the whole testing process just need 1 second to test the function rather than waiting 10 seconds for it to reopen the whole apps.

Author: fyhao

Jebsen & Jessen Comms Singapore INTI University College Bsc (Hon) of Computer Science, Coventry University

Leave a Reply