facebook.request( ) issues

Hi Everybody,

I'm trying to develop an app that pulls in the gender from all of a user's facebook friends. Then the user selects male, female, or both. After that 3 from the desired catagory will be randomly chosen and their profile photos and names will appear onscreen.

I'm using facebook.request( "me/friends" ) but that returns their names and friend id's. But using the friend ids I'm having trouble pulling out the gender, which is listed as public information, without going through a login process. I've tried to use "http://graph.facebook.com/".. friendID .."/gender" but that doesn't seem to be working. I also need this to be fairly fast in case someone has 2000 friends. I imagine I'll be able to use facebook.request( ) for this, but I haven't found a way to do anything with it that doesn't involve "me".

In a separate issue, I've figured out how to pull in profile pictures, but they are really really small. Is there a method to get a larger size image? This doesn't need to be fast because I'm only going to be pulling in three at a time. Here's my working code for the profile pictures:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--the friend id's are already loaded into a variable called data. So data[i].id will pull in a single id.
 
--displaying pictures using graph.facebook method (only returns 50 pixel images
local function networkListener( event )
        if ( event.isError ) then
                        print ( "Network error - download failed" )
        else
                        event.target.alpha = 0
                        transition.to( event.target, { alpha = 1.0 , xScale = 2, yScale = 2} )
        end
        
        print ( "RESPONSE: " .. event.response )
end
 
for i=1,#data do
        display.loadRemoteImage("http://graph.facebook.com/".. data[i].id .."/picture","GET", networkListener, "image"..i..".png", system.TemporaryDirectory, 200,i*100)
end

Still can't figure out the gender issue but I got the picture issue fixed.

You can request a larger picture by adding "?type=large" to the end of your url. Like this:

1
display.loadRemoteImage("http://graph.facebook.com/".. data[i].id .."/picture?type=large","GET", networkListener, "image"..i..".png", system.TemporaryDirectory, 200,i*100)

A mere 4 hours later and I've got a solution.

Instead of calling

facebook.request("me/friends")

I need to call

facebook.request( "me/friends?fields=name,id,gender" )

and that will return only the items I specifically ask for.

views:1613 update:2011/10/4 8:06:35
corona forums © 2003-2011