Critical Android/PhoneGap issue
Ugh. I spent a few hours this week trying to figure out why a previously-working PhoneGap app was having an odd issue in one small part of the application. The issue involved a set of buttons that linked to a detail page. Each link pointed to the same HTML file and used a URL parameter to pass along information. In other words, something like detail.html?id=1 or detail.html?id=2. I've blogged about this before.
As I said - this worked fine until this week. Admittedly this part of the application wasn't something I had used in a long while but the other users of the application weren't seeing any issue at all.
Turns out - Honeycomb and higher Android versions do not support this type of URL anymore. You can read more about the bug here: http://code.google.com/p/android/issues/detail?id=17535.
Frankly I'm in awe that something so simple is still broken over a year later. Why didn't I see the issue before? Simple - my last phone wasn't ICS. Ditto for the other folks testing the application. As it stands, Kyle Dodge warned me about this in a comment on my blog post, but it didn't really sink in. (Sorry Kyle!)
There is a pull request with Cordova to fix this issue, but from my reading it appears to "fix" it by removing the parameters. (I could be wrong on that!) That isn't a fix to me.
For now - I'm going to:
1) Use data-foo to store the value. 2) Use a click handler to notice the click and store the value in LocalStorage 3) Update the code to get the value from LocalStorage

I'm sure you already know it, but the big "a-ha" for me going from ColdFusion to JQM (in addition to your book, of course), was this page:
http://jquerymobile.com/demos/1.0/docs/pages/page-...
Basically, trapping the "before page change", parsing the URL, building the page, then injecting it. Working great on ICS (GNex) and JB (Nexus7).
I'm using Build though so 2.0.0 is not an option yet.
Any plans to revise that article for ICS?
Also Jelly Bean involves native speech dictation and I would like to see if PhoneGap app can expolit the same?
https://github.com/macdonst/iris
That is my demo app that uses speech/tts.
<a href="projectDetails.html" onClick="return storePage(' + project.id + ');">
function storePage(pageID){
localStorage.setItem('projectID',pageID);
return true;
}
<a href="projectTaskDetails.html" onClick="return storePage(' + taskLists.id + ');">
function storePage(pageID){
console.info('inside onClick taskLists function'); //this does not fire
localStorage.setItem('tlID',pageID);
return true;
}
Just wondering if you had set your OnClick method to do the 'return function(arg);' Maybe I just have a syntax error :|
I talked to someone in the JQM forums and changed it to use a click event. For some reason, I don't think any click events are firing in ICS. I've tried changing from .on to .live because pageshow only works when it is called with .live. But neither .on or .live work on the click event. Is this a similar to format to how you are handling it?
$.each(results, function(i,project){
$projectList.append('<li><a href="projectDetails.html" data-id="' + project.id + '">
});
$projectList.live('click', 'a', storePage);
$projectList.listview('refresh');
});
function storePage(){
var pageID = $(this).data('id');
console.info('inside storePage on project list');
localStorage.setItem('projectID',pageID);
return true;
}
As for on/live, I prefer on normally. I don't use click, and you shouldn't either, since it is slower on mobile. touchstart is normally preferred (or touchend).
I'm considering using Phone Gap for cross platform development apps. Please tell me a.s.a.p. as I have a job that depends on it.