Calling Twitter API v1.1 from PhoneGap (preview)


See the finished post is here.


I am currently working my next post which is calling the Twitter API v1.1 from PhoneGap/Cordova. I just got the code executing, but I still need to do some clean up. This post is only a preview. 

In addition to PhoneGap, I also use the following open source packages: jQuery, Backbone/Underscore, ChocolateChip-UI, and Moment.JS. The end results looks pretty good and performs pretty snappy. 

jQuery does all of the ajax calls. Unlike when used in web site code, PhoneGap apps don’t have any cross domain problems. Just remember to add any web site you’d wish to call to your apps white list. 

Backbone is used for its ability to keep all of my collections neatly together. Underscore while a hard requirement for backbone is also used for its ability to render client-side templates, something that is important since Twitter is only going to feed you raw data.

ChocolateChip-UI is a fantastic package which gives your apps the correct look and feel for the platform they are running on. Using PhoneGap’s merges directory, you can make a build with the correct CSS files for the desired device. Besides the shown iOS and Android, it also supports Windows Phone 8. I plan to play with that just as soon as I can get my hands on a device. 


Finally there is Moment.js. It is the quintessential time handling library. Ever try to write a method to display time the way Facebook or Twitter does? You know, how long ago something was instead of when something happened? Moment has that and lots more built in. Getting the time to display correctly is a single method call.

It will probably be the weekend until I have enough time to finish the post. Besides cleaning the code up, I also want to create a plugin for it.

I am putting all of my PhoneGap code together into a book on PhoneGap. This book covers version 3+ of PhoneGap and all of things one needs to do to create production quality apps with it. Most of the code in the book has never been published. Beside using Twitter API v1.1, I cover: Audio, Video, Camera, Maps, Location, Icons, Splash pages, Debugging and setting up your build environment. I plan to self-publish on Amazon, April 2014.

Also, if you’d like more PhoneGap posts, please click the +1. I try to write post based on what I think readers like. The +1 eliminates the doubt. Thanks.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s