Android Code Snippet Share Facebook

Discussion in 'Code Snippets' started by MarcoRome, Feb 21, 2015.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi all. This is intent to share to Facebook.

    Code:
    Code:
    '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
     

    Attached Files:

    f0raster0, Procesor, scsjc and 10 others like this.
  2. asales

    asales Well-Known Member Licensed 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.
     
  3. MarcoRome

    MarcoRome Expert Licensed User

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

    Code:
    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.
     
    asales likes this.
  4. Wolfgang Trageiser

    Wolfgang Trageiser Member Licensed 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)??
     
  5. DonManfred

    DonManfred Expert Licensed User

    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.
     
  6. MarcoRome

    MarcoRome Expert Licensed User

    Try
     
  7. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    And to like it on Facebook
    Thank you
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice