Facebook SDK Wrapper + Native Facebook LoginButton

Douglas Farias

Expert
Licensed User
Longtime User
nop
only here
#AdditionalRes: C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
 

Attachments

  • Sem título.png
    Sem título.png
    215 KB · Views: 284

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
You have to put the google-play-services.jar in your b4a lib folder or in your additional lib folder

The error means that it can not find a component from that jar.

Goto

C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs

and copy the google-play-services.jar in your b4a lib folder or in your additional lib folder
 

Douglas Farias

Expert
Licensed User
Longtime User
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *-* done *-*

thx man now works *-*
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User

Douglas Farias

Expert
Licensed User
Longtime User
hi @Periklis Koutsogiannis
man how can i post in another activity?
i m using common = your sample 1

on my main i have this
Dim ThisActivity As SocialApiActivity
and this on resume
Common.FB.SetActivity(ThisActivity.GetWithEvent("facebook_statuschanged_event"))


on my activity 2 with name telaprincipal i have
Dim ThisActivity As SocialApiActivity

on resume this
Common.FB.SetActivity(ThisActivity.GetWithEvent("facebook2_statuschanged_event"))


and this
Dim Result As FacebookResult = Common.FB.PublishPost("Confira o aplicativo que distribui dinheiro pela cidade. Lançamento em BREVE!!!","http://www.vallow.com.br/achouganhou/", "http://www.vallow.com.br/achouganhou/compartilhar.png" ,"Achou Ganhou", "www.vallow.com.br/achouganhou", "O aplicativo que distribui dinheiro pela cidade confira!")
If Result.Canceled Then Return

If Result.Success Then
updatecompartilhou
Else
Msgbox("ERRO AQUI", "TESTE")
End If

I TESTED ON MOTO G AND WORKS FINE I CAN POST
AND I CAN SEE on the facebook my post

i have problem with s3

with s3 i have

Msgbox("ERRO AQUI", "TESTE")

u know why?
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
It must be the lack of publish permissions. The Result.Message has the error message. What does it contain?

B4X:
If Result.Success Then
    ...
Else
   Log(Result.Message) 'It contains the error message 
End If
 

Douglas Farias

Expert
Licensed User
Longtime User
here only on s3 moto g is normal
 

Attachments

  • 10449730_917895704902953_111914046_n.jpg
    10449730_917895704902953_111914046_n.jpg
    43.8 KB · Views: 280

Douglas Farias

Expert
Licensed User
Longtime User
nops i need this ? on my moto g dont need *-*
 

Douglas Farias

Expert
Licensed User
Longtime User
In order to post, you have to ask for publish permissions first.

Code:
Facebook.RequestPublishPermissions

ok thx man i go try
 

Douglas Farias

Expert
Licensed User
Longtime User
aa my s3 have no batery =(
but is this?

B4X:
    Common.fb.RequestPublishPermissions
        Dim Result As FacebookResult = Common.FB.PublishPost("Confira o aplicativo que distribui dinheiro pela cidade. Lançamento em BREVE!!!","http://www.vallow.com.br/achouganhou/", "http://www.vallow.com.br/achouganhou/compartilhar.png" ,"Achou Ganhou", "www.vallow.com.br/achouganhou", "O aplicativo que distribui dinheiro pela cidade confira!")
        If Result.Canceled Then Return

        If Result.Success Then
            updatecompartilhou
        Else
            Msgbox("Erro ao compartilhar tente novamente!", "Achou Ganhou")
        End If
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
After the users has logged in, ask for permissions in the facebook_statuschanged_event

B4X:
Sub facebook_statuschanged_event

    If Common.fb.JustConnected AND Not(Common.fb.Failed) Then

        'Check if publish permissions already granted
        Dim HasPublishPermission As Boolean = False

        For i = 0 To Common.fb.Permissions.Length-1
            If Common.fb.Permissions(i) = Common.fb.Constants.Permissions.PUBLISH_ACTIONS Then
                HasPublishPermission = True
                Exit
            End If
        Next

        If Not(HasPublishPermission) Then
            CallSubDelayed(Me, "AskForPermissions")
        End If
    End If
End Sub

Sub AskForPermissions
    Common.fb.RequestPublishPermissions
End Sub
 
Last edited:

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
Or do a quick and dirty job. If the post failed ask for permissions :)

B4X:
Dim Result As FacebookResult = Common.FB.PublishPost("Confira o aplicativo que distribui dinheiro pela cidade. Lançamento em BREVE!!!","http://www.vallow.com.br/achouganhou/", "http://www.vallow.com.br/achouganhou/compartilhar.png" ,"Achou Ganhou", "www.vallow.com.br/achouganhou", "O aplicativo que distribui dinheiro pela cidade confira!")
If Result.Canceled Then Return

If Result.Success Then
    updatecompartilhou
Else
    Common.fb.RequestPublishPermissions
End If
 
Last edited:

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
The first method will ask the user to grant permissions when connected.

The second one will ask when posting has failed.
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
The latest socialapi (2.31) has a FacebookProvider.HasPermission method.

So you can do before posting:

B4X:
Dim Result As FacebookResult = Common.fb.PublishPost("Confira o aplicativo que distribui dinheiro pela cidade. Lançamento em BREVE!!!","http://www.vallow.com.br/achouganhou/", "http://www.vallow.com.br/achouganhou/compartilhar.png" ,"Achou Ganhou", "www.vallow.com.br/achouganhou", "O aplicativo que distribui dinheiro pela cidade confira!")
If Result.Canceled Then Return

If Result.Success Then
    updatecompartilhou
Else
    If Common.fb.HasPermission(Common.fb.Constants.Permissions.PUBLISH_ACTIONS) Then
        Common.fb.RequestPublishPermissions
    Else
        Msgbox("Erro ao compartilhar tente novamente!", "Achou Ganhou")
    End If
End If
 
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
realy this dont work xD
B4X:
Common.fb.RequestPublishPermissions
        Dim Result As FacebookResult = Common.FB.PublishPost("Confira o aplicativo que distribui dinheiro pela cidade. Lançamento em BREVE!!!","http://www.vallow.com.br/achouganhou/", "http://www.vallow.com.br/achouganhou/compartilhar.png" ,"Achou Ganhou", "www.vallow.com.br/achouganhou", "O aplicativo que distribui dinheiro pela cidade confira!")
        If Result.Canceled Then Return

        If Result.Success Then
            updatecompartilhou
        Else
            Msgbox("Erro ao compartilhar tente novamente!", "Achou Ganhou")
        End If

i go try your 2°
 
Top