Android Code Snippet Share Facebook

Hi all. This is intent to share to Facebook.

Code:
B4X:
'App ID Facebook
Dim app_id As String = "1541645*******" ' <--- Here put your ID Facebook
Dim redirect_uri As String = "https://www.facebook.com"
Dim name, caption, description, picture, link, all As String


link = "https://play.google.com/store/apps/details?id=com.devil.app.barzellette"
name = "App Barzelletta"
caption = "************"
description = "This is description also long ...we see Lorem ipsum dolor sit amet," & _
"test link adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus." & _
"Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec," & _
"gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo," & _
"eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy." & _
"Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat In, nunc. Morbi imperdiet augue quis tellus."



all = "https://www.facebook.com/dialog/feed?app_id=" & app_id _
    & "&link=" & link _
    & "&name=" & name _
    & "&caption=" & caption _
    & "&description=" & description _     
    & "&redirect_uri=" & redirect_uri


Dim i As Intent
    i.Initialize(i.ACTION_VIEW, all)
    i.SetType("text/plain")
    i.PutExtra("android.intent.extra.TEXT", all)
    StartActivity(i)

This is result smarthphone when you click button "Share to FB":

share_fb_smartphone.png


and this is result:

share_fb.png


Example in attachment.
Bye
 

Attachments

  • TestFb.zip
    8.2 KB · Views: 783

asales

Expert
Licensed User
Longtime User
Hello @MarcoRome.

How I can post in the Facebook only a image (in File.DirDefaultExternal) using this code?

Thanks in advance for any tip.
 

MarcoRome

Expert
Licensed User
Longtime User
Hello @MarcoRome.

How I can post in the Facebook only a image (in File.DirDefaultExternal) using this code?

Thanks in advance for any tip.

I think yes. But again dont try.
You can try this online in your browser:

B4X:
https://www.facebook.com/dialog/feed?app_id=154165*****&name=Test&description=Test2&picture=Yourimagine&redirect_uri= redirect_uri=https://www.facebook.com

where 154165**** is your ID Facebook and Yourimagine is your picture.
 

Wolfgang Trageiser

Member
Licensed User
Longtime User
Hello,

nice work.
Why there is no password needed to insert/share in Facebook?
If i know a facebook-id of my friend - i can push/share something in HIS account (with your code)??
 

DonManfred

Expert
Licensed User
Longtime User
If i know a facebook-id of my friend - i can push/share something in HIS account (with your code)?
I guess NO.
The app uses YOUR Facebook App-ID.
Your friend probably dont have a App-ID.

Just my 2cent. I can´t answer this as i do not use the lib and i do not have a Facebook-App-ID.
 
Top