how to show a user facebook profile picture ?

hi
i’m building an app that incorporates a facebook profile.
how do i show a user facebook profile picture ?
and how do i find out a user’s facebook ID ?

if someone has examples on how to do it it would be great…

thanks…
[import]uid: 173648 topic_id: 31989 reply_id: 331989[/import]

Normally, you would first call their “me/friends” API call using network.request(). This will return you a JSON structure that you can easily turn into a lua table with:

local friends = json.decode(event.response)  

In that friends table will be a member called photo. It will either be a string, which is the URL to the image on Facebook’s servers. It can also be a table and that table has a member called “url” which is the URL. I’ve not figured out the rhyme or reason to why Its one way sometimes and the other way others.

Anyway, once you have the URL, you can use network.download() or display.loadRemoteImage() to fetch the image to your local cache storage and then display it using regular techniques.

Edit: Forgot to add, the ID of the user is also a member of that table returned by the me/friends request.
[import]uid: 19626 topic_id: 31989 reply_id: 127579[/import]

i tried that but it doesn’t go through the json.decode line.
for some reason i can’t decode the json file properly…
after decoding the event.response it turns into a nil value
i managed to nerrow it down to the fact that i’m not getting a proper json back from the event.respons
even in the corona example > here >

http://docs.coronalabs.com/api/library/facebook/login.html

it suppose to build a list of friend but when i use it (and change the facebook app id to the currect one)
it does nothing.

can you show me a full code that show’s a profile picture or get a facebook user id or even both ?
with an appID let’s say, 314542735310401 . ?
[import]uid: 173648 topic_id: 31989 reply_id: 127687[/import]

Normally, you would first call their “me/friends” API call using network.request(). This will return you a JSON structure that you can easily turn into a lua table with:

local friends = json.decode(event.response)  

In that friends table will be a member called photo. It will either be a string, which is the URL to the image on Facebook’s servers. It can also be a table and that table has a member called “url” which is the URL. I’ve not figured out the rhyme or reason to why Its one way sometimes and the other way others.

Anyway, once you have the URL, you can use network.download() or display.loadRemoteImage() to fetch the image to your local cache storage and then display it using regular techniques.

Edit: Forgot to add, the ID of the user is also a member of that table returned by the me/friends request.
[import]uid: 19626 topic_id: 31989 reply_id: 127579[/import]

i tried that but it doesn’t go through the json.decode line.
for some reason i can’t decode the json file properly…
after decoding the event.response it turns into a nil value
i managed to nerrow it down to the fact that i’m not getting a proper json back from the event.respons
even in the corona example > here >

http://docs.coronalabs.com/api/library/facebook/login.html

it suppose to build a list of friend but when i use it (and change the facebook app id to the currect one)
it does nothing.

can you show me a full code that show’s a profile picture or get a facebook user id or even both ?
with an appID let’s say, 314542735310401 . ?
[import]uid: 173648 topic_id: 31989 reply_id: 127687[/import]