John M. Wargo

Twitter Feed

johnwargo: Here we go - First-time smartphone buyers favor Android over iOS: http://t.co/mQwxRHDP
johnwargo: Ummm, eating a handful of Dark Chocolate M&M's So good!
johnwargo: Working on the book's preface, hard 2 keep myself from saying 'the book you hold in your hand' since many won't ever actually hold the book
johnwargo: When sending an email to a group, why is it that Lotus Notes is smart enough to not send me a copy if I'm in the group but Outlook isn't?
johnwargo: Staying at a hotel without a gym. Ugh. I didn't even think to check to see if they had one, assumed they did.
Home
PhoneGap Alerts PDF Print E-mail
Saturday, 19 November 2011 22:03

I was working on Chapter 12 of PhoneGap Essentials tonight and I created a quick PhoneGap application to test something I wanted to verify about the JavaScript alert() function. When I tested the application, I noticed something interesting, taking a look at the following code - when I ran the application on an iOS simulator, the Test 2 alert executed before the Test 1 alert.

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <script type="text/javascript" charset="utf-8" src="/phonegap-1.0.0.js"></script>
    <script type="text/javascript" charset="utf-8">
    
    function onBodyLoad()
    {        
        document.addEventListener("deviceready",onDeviceReady,false);
    }
    
    function onDeviceReady()
    {
        navigator.notification.alert("Test 1")
        alert("Test 2")
    }
    
    </script>
  </head>
  <body onload="onBodyLoad()">
        <h1>Alert Test</h1>
      <p>This is a test application.</p>      
  </body>
</html>

I know that PhoneGap had finished initializing since the deviceready event fired, but apparently there's something going on that would cause the first alert to queue up and only execute after the second alert, the one using the standard JavaScript alert instead of the PhoneGap alert function, fired.

Interesting. Not important, but interesting.

Postscript: OK, I was randomly thinking about something this morning and the solution to this particular item popped into my head. The reason why the PhoneGap alert displays after the JavaScript alert is that the PhoneGap call is asynchronous and the JavaScript alert is a synchronous call. The application passes off the call to display the PhoneGap alert then immediately calls the JavaScript function to display the alert. The JavaScript code executes faster while the PhoneGap code is getting it's work done, the JavaScript code has already fired and is blocking the PhoneGap alert function until the user clicks the OK button.

Yep, it helps when you actually think through things.

 
PhoneGap Essentials PDF Print E-mail
Tuesday, 15 November 2011 22:30

Lots going on here on the book front. Last week, my publisher and I agreed on a different title for my PhoneGap book. It's going to be called PhoneGap Essentials, and we even finally have a cover for the book as well.

We wrapped up the table of contents, a description of the book and my bio last week and it looks like everything got submitted to Amazon because it went on the www.amazon.com site today for pre-order. You can access the book's page here: PhoneGap Essentials. Please use that link to pre-order the book since I make a little more money that way.

I'm working my way through the manuscript. I'm 155 pages into the book (out of about 220 total typed pages) and I have about 6 chapters to finish by the end of the year. I'm having a lot of fun writing this book and can't wait to hold it in my hands.

 
(more) PhoneGap Build Problems PDF Print E-mail
Friday, 11 November 2011 08:29

PhoneGap Build's BlackBerry capabilities have been down for the last two weeks. I've been working through the book's API chapters, writing applications that highlight the capabilities of each and using PhoneGap Build to quickly build an application I can test on multiple devices. It allows me to simply create the index.html file I need, post it up to the server and within minutes (PhoneGap Build is NOT fast) get an application I can deploy to devices for testing.

This capability is especially helpful when I was working with the API's related to physical hardware (such as the compass and the accelerometer) since those applications had to run on physical devices and it's much simpler to deploy via the web for testing.

I first noticed the problem when none of the BlackBerry applications I was working with would fire the deviceready event. After a lot of poking around, I discovered that the problem indicated that the PhoneGap.js file wasn't being included in the BlackBerry application's executable (the .cod file). It would work every once in a while, but 99.9% of the time, PhoneGap Build would build the app, but forget to include the critical phonepap.js file needed to access any of the PhoneGap API's.

I searched the knowledge base and found another who was having the same problem and even submitted my own tickets on the problem, but as of yesterday it still wasn't working. I know someone from Nitobi is working on it, but I'm not getting any details on the problem or a possible estimate for when it might be fixed.

I wasn't sure about the value of the PhoneGap Build service when I first started working on the book. It wasn't until I got into working with the apps I needed to write to support my writings that I realized how cool the service is when you're doing this kind of work. It allows you to quickly pen an app by only writing the index.html (and associated files) then gives you apps for multiple platforms without all of the fuss and muss of creating projects for each platform. Now that it's broken, it's making it very hard for me to get my work done.

Hopefully it will be fixed soon, although hope is not a strategy.

 
BlackBerry DevCon App on WebWorks PDF Print E-mail
Monday, 07 November 2011 07:50

During BlackBerry DevCon 2011 I did some analysis of the BlackBerry DevCon 2011 mobile application; it was part of my everlasting "What Were They Thinking" series of articles. In the article, I postulated that the application was a BlackBerry WebWorks application which made sense since it's RIM's direction for mobile application development on BlackBerry and because it's a cool and quick way to build mobile applications.

Quickly after I wrote that article, I was able to validate that it is a WebWorks application. I was working in the application and accidently selected some of the text on one of the screens (or should I say pages since it's a WebWorks application?) and saw the screen shown in the following figure. Those little blue pointy things shown in the figure are the text selection icons you get when working within the browser.

I wonder if there's a way to turn that off in WebWorks? There should be, but I haven't seen any settings in the config.xml file that would allow that. Something for RIM to consider adding.

 
<< Start < 1 2 3 5 7 8 9 10 > End >>

Page 5 of 51

InformIT (Pearson Education)