0

I have an app using the Android Facebook SDK 2.0. I am not able to upgrade this at this time so migrating to SDK 3.0 is not a viable solution.

I'm usting a Facebook instance called fb and have successfully requested and gained permissions. I am able to retrieve a list of albums the user has using the following code:

String json = fb.request("/me/albums");

I successfully get the list and am able to construct an array of objects containing only the data I need.

What I'm trying to accomplish is downloading the cover photo so that I can display this to the user. I have tried making a raw http request to https://graph.facebook.com/me/picture/<picture id>?type=square&access_token=<access token given by fb.getAccessToken()>. When I make the request I get a 400 response code (invalid request). I thought this had something to do with Facebook redirecting away to akamai for the actual image and updated the code to make a second graph request through the Facebook class.

I am now making the request fb.request("/me/picture/<picture id>?redirect=false") to get the json data containing the akamai url. I get a message that I must provide an access token, so I added &access_token=<access token given by fb.getAccessToken()> and receive an error that the access token is malformed.

I know for certain that the user is not logged out between these requests so there should be no issue there.

I must be doing something wrong but I don't see what it is.

SnowInferno
  • 449
  • 3
  • 9

2 Answers2

1
 ImageView user_picture;
 userpicture=(ImageView)findViewById(R.id.userpicture);
 URL img_value = null;
 img_value = new URL("http://graph.facebook.com/"+id+"/picture?type=large");//id of facebook user
 Bitmap mIcon1 = BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
 userpicture.setImageBitmap(mIcon1);
mihirjoshi
  • 12,161
  • 7
  • 47
  • 78
  • I'm trying to get their album cover photos to present them with their albums so I can then present them with the pictures in that album and letting them choose an arbitrary photo. To retrieve an arbitrary picture, you are required to provide an access_token, hence my dilemma. – SnowInferno Jun 14 '13 at 22:27
0

It turns out that the http method being used was POST instead of GET.

SnowInferno
  • 449
  • 3
  • 9