Archive

Author Archive

30 minute guide to integrating Foursquare in your Android application

September 5th, 2011 ddewaele 9 comments
In this article, I’m going to show you how you can use Foursquare in your Android application using OAuth 2.0.

We’ll be using 

I’ve decided to use the foursquare-api-java, a project hosted at Google Code, as it offers a rich interface to interact with Foursquare. The same API calls are possible through the Google API client for Java, but it would require you to write your own model classes to do the JSON to Java translation.
I will post some sample code here on how this can be done with the Google APIs client library for java.

In the sample application hosted at Github, we’re going to display a map where the user can select a location. Upon selecting a location, we’ll load up a list of Foursquare venues that the user can select.
Upon selecting a venue, we’ll return to our map, put a marker on the map representing the venue, and allow the user to perform a checkin.

Continue reading “30 minute guide to integrating Foursquare in your Android application” »

Bookmark and Share

Oauth 2.0 flow in Android

August 6th, 2011 ddewaele 32 comments
In this article, I’m going to show you how you can implement an OAuth 2.0 flow in Android.
We’ll be using 

In the sample application, we’re going to execute 1 authorized API call to the Latitude API. The call will return the current location of the user.

Continue reading “Oauth 2.0 flow in Android” »

Bookmark and Share
Categories: OAuth Tags: , ,

Developing Android Home Screen Widgets

May 24th, 2011 ddewaele 19 comments
In this article, I’ll be showing you how to create a widget for the Android homescreen. Widgets can be useful to provide condensed information, without necessarily having to open your application. In addition to showing information, a widget can also be used to trigger certain actions related to your application. Instead of forcing the user to open up your application and navigating to a certain screen to perform an action, a widget can provide the user with a quick shortcut to that action. You can also dynamically change the layout of your widget (ex: when the user presses a button, the button can be highlighted, or a piece of text can altered). This article is accompanied by a sample android application that includes the widgets we’ll be discussing here.

Continue reading “Developing Android Home Screen Widgets” »

Bookmark and Share

New way to create test users in Facebook

May 7th, 2011 ddewaele 3 comments

Introduction

As mentioned in the Facebook developer docs, test users can only be created using a call to the Graph API.
As described in my previous Facebook article, a dedicated webpage was available at the time to create test users, however, that page has been brought offline. 

You can create a test user associated with a particular app using the Graph API with your app access token.


https://graph.facebook.com/APP_ID/accounts/test-users?

  installed=true
  &permissions=read_stream
  &method=post
  &access_token=APP_ACCESS_TOKEN

However, before we’ll be able call this API, we first need to retrieve an Access Token for our application.

Continue reading “New way to create test users in Facebook” »

Bookmark and Share
Categories: Facebook SDK Tags: ,

OAuth in Android using the Google APIs Client Library for Java

April 12th, 2011 ddewaele 6 comments
Today we’ll be looking at the Google APIs Client Library for Java.  The API is provided by Google, and is a flexible, efficient, and powerful Java client library for accessing any HTTP-based API’s on the web. According to Google, it is the recommended library for accessing Google API’s based on REST or JSON-RPC. One of the nice things about this library is that it fully supports the Android environment out of the box. So we’ll focus on those features in this article. oauth-android-logo

To avoid confusion, Google offers the following APIs (the first one being the topic of this post, and compatible with the Android platform) :

Unfortunately, there are no samples available that perform the OAuth dance in Android using this library, so I thought I’d write one myself. The code for this article can be found in the AndroidOauthGoogleApiJavaClient repository
Continue reading “OAuth in Android using the Google APIs Client Library for Java” »

Bookmark and Share

A 30 minute guide to integrating Facebook in your Android application

February 28th, 2011 ddewaele 87 comments

Introduction

The goal of this article is to get Facebook integration up & running from your Android app in 30 minutes. The guide will show you how to

  • setup a Faceook test account
  • register a Facebook application
  • authenticate the user in your Android application.
  • have the user update his Facebook wall from your Android application.

This guide is accompanied  by a sample application that’s available in Github in the AndroidFacebookSample repository. To import this project in Eclipse, I suggest using the EGit plugin that can be installed via the Main P2 Repository located at http://download.eclipse.org/egit/updates.

Before running this project, make sure you change the com.ecs.android.facebook.Sample.AndroidFacebookSample file to include your Facebook API key (see subsequent section).
Once you have sample application up & running, you can copy the relevant classes into your projects to have Facebook up & running from your Android application.

First things first … In order to integrate with Facebook, you need 2 things :

  • A Facebook test account, used in our Android application to login to Facebook and make status updates.
  • A Facebook application, used to inform the user in your Android application that this application is requesting you to login to Facebook.

Continue reading “A 30 minute guide to integrating Facebook in your Android application” »

Bookmark and Share
Categories: Facebook SDK Tags: , , ,

A 30 minute guide to integrating Twitter in your Android application.

February 13th, 2011 ddewaele 51 comments

Important note : As an update to this article, I’ve prepared a new post entitled Improved Twitter OAuth for Android focussing on a more simple Oauth / Android experience, and using the Google APIs Client Library for Java.


The goal of this article is to get twitter integration up & running from your Android app in 30 minutes. The guide will show you how to

  • setup a twitter test account
  • register a twitter application
  • authenticate the user in your Android application.
  • have the user send tweets from your Android application.

This guide is accompanied  by a sample application that’s available in Github in the AndroidTwitterSample repository. To import this project in Eclipse, I suggest using the EGit plugin that can be installed via the Main P2 Repository located at http://download.eclipse.org/egit/updates.

Before running this project, make sure you change the com.ecs.android.sample.twitter.Constants file to include your consumer key and consumer secret. (see subsequent section).
Once you have sample application up & running, you can copy the relevant classes into your projects to have Twitter up & running.

Twitter uses the OAuth protocol to authorize your android application to send tweets on behalf of the end-user. The end-user will need to authenticate against Twitter (meaning that your application will not capture the twitter username / password). Once the user has authorized access, you’ll be able to send tweets on behalf of the user. We’ll use signpost library to handle the OAuth communication, and the Twitter4J library to handle the Twitter specific interactions (sending tweets).

Continue reading “A 30 minute guide to integrating Twitter in your Android application.” »

Bookmark and Share
Categories: OAuth Signpost Tags: , , ,

Using Google Maps in your Android Application

January 18th, 2011 ddewaele 21 comments
In order to use Google Maps in an Android application, you need to make sure that the application is properly setup to be able to host a MapView.

Although it only takes a couple of steps to prepare your application for using Google Maps, failing to complete or skipping one of these steps can quickly turn this into an error-prone process.

The goal of this article is to go over the required steps in order to use Google Maps, and to list down the common mistakes that result in errors.

Continue reading “Using Google Maps in your Android Application” »

Bookmark and Share
Categories: Google Maps Tags: ,

Understanding the LocationListener in Android

December 25th, 2010 ddewaele 8 comments

Introduction

Everybody who has done some Android development involving GPS location tracking is probably familiar with the LocationManager and LocationListener concepts.

  • The LocationManager provides access to the system location services
  • The LocationListener is used for receiving notifications from the LocationManager when the location has changed

However, there seems to be some doubt regarding the minTime and minDistance parameters that can be provided to the requestLocationUpdates call, and the way the locationlistener behaves.

Android Locationlistener

Continue reading “Understanding the LocationListener in Android” »

Bookmark and Share

Integrating maven in your Android Eclipse projects

December 14th, 2010 ddewaele 5 comments
Managing dependencies is very important in software development. The ability to declare your dependencies, handle transitive dependencies, and fetch these dependencies automatically is one of the benefits of using Maven. Today I installed Ubuntu on my laptop, and started checking out my Android projects from my GitHub repository.
During that checkout, I was ashamed to find that some of them had external dependencies declared that couldn’t be found on my newly installed system.The dependencies were pointing to a location on the desktop of the machine where I did the check-in. Shame on me.

maven-logo

maven-logo

One of the strenghts of maven2 is that by declaring the dependencies in the pom.xml, anyone checking out the pom will automatically have all of it’s dependencies resolved.
Having a JEE background, where maven2 is heavily used in my everyday working environment, I wondered if it was possible to combine maven2 with my Android projects, and came accross 3 interesing projects that make it possible.
The goal of this article is to provide you with a step-by-step guide to glue everything together, and start developing your Android apps in Eclipse using Maven2.
Continue reading “Integrating maven in your Android Eclipse projects” »

Bookmark and Share
Categories: Eclipse IDE Tags: , ,