Facebook Photo Picker for Android

by

Select Album Screen

On a recent project, we needed a widget that would allow users to select a photo from their Facebook albums. “Surely the new Facebook Android SDK must support this.” I thought. Alas, my hopes were unfulfilled. “Well, I bet there is a third-party solution for this!”, I surmised, but again, my search was for naught. At this point I decided to roll up my sleeves and do it myself.

The Facebook SDK does not readily support access to photos, which seems like a common use case for which they would expose a dedicated set of API calls. Instead, one needs to make specific Facebook Graph calls using the SDK’s Request class. One thing to pay attention to is the packaging of parameters to pass to the Request constructor. Not you use an android.os.Bundle to package the parameters, and the structure can be derived from the Facebook Graph API Explorer.

I’ve created an Android Library project so you can use this on your next project that needs access to Facebook photos. you can find it on Github here:

https://github.com/GrioSF/AndroidFBPhotoPicker.git

Note you’ll need to create your own Facebook App to support the FBPhotoPickerTestApp. You can find a nice getting started tutorial for the Facebook Android SDK here:

https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

Feel free to fork and modify at will. If you have any suggestions for improvement, please leave a comment and I’ll get on it when I have a chance.

Here are some screenshots to give you an idea of what the UI looks like:

Select Album Screen
Select Album Screen
Select Photo Screen
Select Photo Screen

5 Comments

  1. Anurag on said:

    I want to develop same app which show all photos of the user . i use this app source code this is not working . how to do this can anyone help me?

    • Doug Kadlecek
      Doug Kadlecek on said:

      Unfortunately, we are no longer supporting this code, as it is over 3 years old and Facebook’s & Android’s APIs have changed. you can use it as a guide, however.

  2. Daniel on said:

    Really amazing app!
    It realy works fine!
    Just suggest to fix the back button action,
    It is closing the application when I try to go back.

    But It is so much helpfull, thanks dude.

  3. Thomas Florelli on said:

    Thank you for that !

    It works perfectly and I even learnt some stuff about the facebook sdk (especially that LoginButton that handles everything for you, they didn’t talk about it when i read the tutorials ^^)

    There is one thing: I’m not sure you talked about that koush library dependence for “UrlImageViewHelper” in your article or on your repository. I had to find it myself, though it was not very difficult :p

    Anyway thank you again !

    By the way you don’t talk about the license, is there any ?

    • Doug Kadlecek
      Doug Kadlecek on said:

      Hi Thomas,

      There is no license. Feel free to use as you wish.

Leave a Reply to Thomas Florelli Cancel reply

Your email address will not be published. Required fields are marked