My ramblings on mobile application development, Android, iOS, Microsoft, and Open Source technologies.
Tuesday, December 6, 2011
Debugging Phonegap/Cordova Applications
When developing a mobile application with PhoneGap, there inevitably comes a point when things don't work as expected.
When this happens, I triage the application in the following order:
Verify event binding
Inspect variable values
Wire protocol analysis
Verify Event Binding
Inspecting Variable Values
Wire Protocol Analysis
If your user interface looks right with the data you're expecting, but you're not getting what you're expecting, it's time to rule out issues between the client and the server. In these cases, I like to use WireShark to capture the communication between the client and the server (again isolating the physical device as much as possible from the equation). Before selecting the network interface to capture on, I navigate in my application as far as possible before the issue in question. This reduces the junk I have to look through while debugging. You can definitely do this with filters in WireShark, but for the novice, it's easier to limit the incoming data.
When none of these techniques solve my problems, I tend to post to the phonegap google group. I encourage all of you to do the same and please don't be shy if you have a possible solution to someone else's problem. Even if it isn't the perfect answer, it can set someone on the road to success.