B4A Library Facebook

Douglas Farias

Expert
Licensed User
Longtime User
B4X:
                TheFields.AddAll(Array As String(fb.USER_CONNECTION_PICTURE, fb.USER_FIELD_NAME, fb.USER_FIELD_GENDER, fb.USER_FIELD_HOMETOWN,"name", "picture.height(200).width(200)"))

this works fine return a image with best quality *-* ty
 

pesquera

Active Member
Licensed User
Longtime User
Hi NDJude, does this library include the facebook chat api? I want to intercept income messages.. thanks
 

RjCl

Member
Licensed User
Longtime User
NJDude,

Its good library, thanks

But about the permissions,............I just need the default permissions that Facebook gives when we make app on their site, (profile, email and friends)
How to that in the permissions list?
 

Douglas Farias

Expert
Licensed User
Longtime User
NJ is possible get user photos?
albuns etc?

and how to show this photos in app?
 

NJDude

Expert
Licensed User
Longtime User
You will have to get the Album ID and then get the pictures (URLs), download them and then display them on an ImageView, for more info, refer to the Facebook documentation, using the library you could use "GetFields", something similar to the example I posted before.
 

Douglas Farias

Expert
Licensed User
Longtime User
yes download i know but realy need download all images ? *-*
dont have a way to put this on webview ?
 

RjCl

Member
Licensed User
Longtime User
The default permissions are added automatically, but any extras must be added using the library.

I tried the lib with your demo, but it lets me uploaded, file and message to timeline, even though i didnt give any more permissions and neither does my Facebook app asked for any other than the default ?

Plus, i thought that to publish on behalf of user requires extra permissions for which the Facebook app has to be submitted for approval they are given?
 

Douglas Farias

Expert
Licensed User
Longtime User
NJ sometimes the permission screnn bug show only de x to close, and dont show ok button etc webview click i thing
its possible show this permission only 1 time?
i m using normal login not with permissions
 

Douglas Farias

Expert
Licensed User
Longtime User
hmm but this permission screnn need show all time when user log of and log on again?

i m using this code dont have permissions

B4X:
Sub Button1_Click
fb.Login
End Sub
 

Douglas Farias

Expert
Licensed User
Longtime User
a ok ty man

and is there any chance that one day lib log with the official app of the face?

Only the * question * - *

like this

 

Douglas Farias

Expert
Licensed User
Longtime User
nj excuse me ask you again
I'm really trying to fix this mistake and not understand already tried many, many more ways do not think you can help me?

here is the image with the error attached

my code i m using

B4X:
Sub facebook_Click
fb.Login
End Sub

Sub recebedadosdoface
Private TheFields As List ' declara lista
TheFields.Initialize
TheFields.AddAll(Array As String(fb.USER_CONNECTION_PICTURE, fb.USER_FIELD_NAME, fb.USER_FIELD_LOCATION, "gender", "name", "first_name", "last_name","locale","picture.height(200).width(200)")) 'recebe dados + foto de perfil
fb.GetFields("me", TheFields)          
End Sub


Sub myFB_GetFields_Response(JSONText As String)
    Private jParser2 As JSONParser
    If jParser2.IsInitialized = False Then
    jParser2.Initialize(JSONText)
    End If
    'tenta receber os dados do face em JSON se tiver erro tenta denovo
    Try
    Private Root As Map = jParser2.NextObject
    Catch
    recebedadosdoface
    Return
    End Try
  
    'aqui temos os dados recebidos do face
  
    Private UserPicture As Map = Root.Get("picture") 'mapa da foto''''''''''''''''''''''''''''''''''''''''''''''
    Private Data As Map = UserPicture.Get("data") ' data da foto bytes''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    urlfotoface = Data.Get("url")        'aqui sao os dados declarados no top para serem usados durante todo main
    idfacebook = Root.Get("id")        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    username = Root.Get("name")        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    genderface = Root.Get("gender")    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    primeironome = Root.Get("first_name")
    ultimonome = Root.Get("last_name")
    localefacebook = Root.Get("locale")
  
    'tenta pegar cidade atual
    Try
    Private local As Map = Root.Get("location")
    cidadefacebook = local.Get("name")
    Catch
    cidadefacebook = ""
    End Try
    confereusuarioface
              
End Sub

I tried to see and review the code, but I do not understand sometimes gives error and sometimes not of this error.

You already told me that is why json is not receiving data over there a way to fix this?

already tried looking at your example are more equal do not understand why the error = (
 

Attachments

  • Sem título.png
    182.6 KB · Views: 174
Last edited:

NJDude

Expert
Licensed User
Longtime User
A few comments about your code.

If you are using for example fb.USER_FIELD_NAME there's no need to use "...,"name", ..." just use either one.
What's the point to re declare the permissions when an error occurs?, no need to do that.

If the error you're getting "JSON Object expected" happens sporadically, then you will have to take a closer look at the data you're receiving, and move the Try...Catch to see if you can capture the error, debugging is always difficult, that's all I can tell you.
 

RjCl

Member
Licensed User
Longtime User
NJDude,

When having the user logoff from Facebook and then comes back later to login, it makes them re-authorize the Facebook permissions. They seem to be removed when the user logged off ?

Thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…