Experience in Building Mobile Application
I’ve finally completed my maiden HTML5 mobile application but have only managed to target it for Android.
You may download it from getjar.
Fundamentally, I’ve created the application due to a need to manage multiple library-loan accounts within the family. It is a hassle to check the accounts one-by-one for (near-) outstanding loans.
My experience in development follows:
What type of application should I build?
Criteria | Native App | HTML5 App | Mobile Website |
Learning Curve | high | medium | low |
Performance | good | reasonable | reasonable |
Device feature accessibility | all | most | few |
Connectivity tolerance | non-connected | occasional | mostly connected |
Server requirement | NA | NA | Yes |
Quirkiness | Low | High | Medium |
Marketability (on app-store) | Yes | Yes | No |
Portability | Low | Medium | High |
Basic Requirements
- Apache Cordova (PhoneGap) 1.5
- jQuery 1.6.4
- jQuery Mobile 1.0.1
Gotchas!
- I wanted to structure the directories into /js, /css. The easiest way is to move all the javascript files into /js, the css files into /css, and more importantly, the jQM images folder into the /css (as the images are being referenced by the jQM css file)
- Different browsers support HTML5 differently. E.g. input types number and dates are not widely supported.
Android Development
Pre-requisites
- Eclipse – no questions about the need to use Eclipse.
- Firefox with CORS plugin – CORS required in my case as the library loans website does not allow cross-origin requests. The plugin allows me to test without running the emulator.
- Chrome (with start-up parameter --disable-web-security) – similar reason as above. However, the WebKit-based browser like Chrome affords better testing as Android’s browser is also WebKit-based.
- Fiddler2 – to examine the HTTP requests/ responses. This also allows for request manipulation from the browser. (e.g. changing the user-agent)
iOS Development
Pre-requisites
- MacOS 10.7 – no questions about the need to use MacOS.
- XCode 4.3 – no questions about the need to use XCode.
- Developer's license – required for publishing to the appstore.
- PhoneGap 1.5 installation for iOS – basic requirement.
Debugging
- Need to add WebView debugging in Classes/AppDelegate.m (see below)
- To debug, open Safari and go to http://localhost:9999/
- (BOOL) application:(UIApplication*) application
didFinishLaunchingWithOptions:(NSDictionary*) launchOptions{ [NSClassFromString(@"WebView") _enableRemoteInspector]; :}
Gotchas!
- All my javascript functions failed to execute! After much time spent troubleshooting, the reason was found to be due to my debugging statements! (see below)
- All CORS failed until I added them into the whitelist (Cordova.plist -> ExternalHosts) - remember to clean build the project after adding into the whitelist
- Input elements of type="number" produces unexpected results that had to do with regional settings (e.g. 12345 became 12,345)
if (console && console.log) console.info("...."); // failed in PhoneGap
Useful Tools
- Safari
Useful Resources
- http://wiki.phonegap.com/w/page/52010495/Getting%20Started%20with%20PhoneGap-Cordova%20and%20Xcode%204
- http://hiediutley.com/2011/11/22/debugging-ios-apps-using-safari-web-inspector/
- http://stackoverflow.com/questions/7814818/external-image-paths-still-doesnt-show-after-adding-it-to-external-list-on-phon
- Cloud-based building: https://build.phonegap.com/
Comments