Integrating the new Foursquare SDK in to your BlackBerry WebWorks Apps

Web Development

The other day, Kyle from Foursquare announced a couple of new and exciting features for BlackBerry developers to make use of in their apps – Single Sign On and Place Picker cards. This is an absolutely stellar implementation of our Invocation Framework. To compliment his native sample app, I created a BlackBerry 10 WebWorks version. Before you dive in to the code, let’s see what these new cards are all about, and more importantly, why you should be using them in your own applications.

Single Sign On (SSO) Card


The Foursquare Single Sign On card (SSO) makes it extremely UI-friendly for customers to authenticate, and authorize your app to connect with Foursquare. Before the SSO card was created it was up to the developer to open up a web-view, wait for the user to authenticate, close the web-view, and handle all the associated callbacks which would eventually return an OAuth token. It was both a lot of work to implement, and could be a very cryptic and confusing process. SSO eliminates the need for all of that jazz.

To authenticate a user with Foursquare and obtain an OAuth token (used to make authorized requests to their API) you simply invoke the SSO card, wait for the card to close, then grab the returned OAuth token. That’s it. Seriously.

Place Picker Card




The Place Picker card, as the name suggests, is a seamless way to prompt the user to select a near-by location, and instantly provides you, the developer, with a contextually aware application. Just like the SSO card, all of the legwork is handled by the Foursquare SDK. By simply invoking the card, and listening for the onChildCardClosed event, you’re able to handle the returned JSON object any way you see fit in your application.

The Sample App

Again, making use of these new features is incredibly easy. I created a small sample app to show you how to authorize your app with Foursquare via the SSO card, pick a near-by venue with the Place Picker card, and lastly check-in to the selected venue.

As always, the sample app is open sourced, well documented, and hosted on GitHub. Head on over, and check it out!

If you find this sample useful, have any questions, or just want to keep up-to-date on the world of BlackBerry WebWorks and HTML5, follow me on Twitter!

About Chad Tetreault

A developer at heart, I’ve been coding in some shape or form since the age of 13. Nowadays I focus on building awesome cross-platform (Android, iOS, BlackBerry) mobile web applications powered by Cordova, JavaScript, and AngularJS.

Join the conversation

Show comments Hide comments
+ -