Android Tutorial [TUTORIAL] Post to Facebook Wall via B4A app.

Discussion in 'Tutorials & Examples' started by NJDude, May 11, 2012.

  1. NJDude

    NJDude Expert Licensed User

    The attached project shows how to use the device's camera to snap a picture and upload it to your Facebook wall.

    This sample is based on the code written by the one and only vb1992 found in THIS thread.

    - Requirements:

    1- Facebook account.
    2- Facebook app.
    3- Internet connection.

    - How to create a Facebook app

    In order to use this sample you MUST create a Facebook App first, to do that, go to: (the system will prompt you to login if you are not, the user name and password required is your Facebook user name and password).

    1- After you login you will see the Create new app window, then, enter a name and click on Continue (you can leave the rest of the fields blank, if you don't have a website then check the "free webhosting by Heroku" and follow the instructions).

    2- Enter the Security check.

    3- Fill the information on the App Details window, you need to enter:

    • Contact Email
    • Category
    • Select WEBSITE and enter your website (or the one provided by Heroku in case you don't have your own.)
    • Save changes


    Take note of the App ID and App Secret you need those values to be added to the B4A project as well as the Site URL.

    The first time you run the app you'll be prompted to login to Facebook, there's no log off option, the workaround is to CLEAR DATA & CLEAR CACHE, I need to investigate how to do that by code.

    There are a few notes in the B4A project, just follow those simple instructions and you are done.


    Attached Files:

  2. XverhelstX

    XverhelstX Well-Known Member Licensed User

    Great work NJ!

    Thanks a lot for the clear tutorial!

  3. awakenblueheart

    awakenblueheart Member Licensed User

    Why I can't download??
  4. Erel

    Erel Administrator Staff Member Licensed User

    This file is only available to users who bought Basic4android.
  5. RiverRaid

    RiverRaid Active Member Licensed User


    First thank you for your tutorial :) I've done everything exactly like described here. The firsttime login works as expected, but the example never enters the GetFeeds sub.
    It seems like the AccessToken is not retrieved from the URL.
    Do you have any idea?

    Thanks a lot1!
  6. kmap

    kmap Member Licensed User


    where we use appSecret?

    I have searched in the code we are not using it anywhere

  7. luke2012

    luke2012 Well-Known Member Licensed User

    Post to facebook

    There is a way to post to a existent user profile without create an application ?

    I mean post a message using the facebook url by code ?
  8. metrick

    metrick Active Member Licensed User

    I am unable to post message to facebook.
    Nothing happen when I click on POST TO WALL button.
    Trap and log all subs, only SendButton, and facebookpage click are fired.
    appID and appSecret are copy and paste from facebook.
    I have copy and paste "" to browser and is working.
    The only things I changed are appID and appSecret.
  9. NJDude

    NJDude Expert Licensed User

  10. metrick

    metrick Active Member Licensed User

    thank you, got it working. It was the url link.
  11. kamalkishor

    kamalkishor Member Licensed User

    facebook Integration

    How to post on Facebook wall from basic4Android App like on iphone app without using app id, client secret, key hash etc from user Facebook account.

    Please Help.
  12. carchek

    carchek Member Licensed User

    I edited this line with, but when I press send button it doesn't do anything.

    Please help

    EDIT: Got it working after adding / after my domain :)
    Last edited: Jan 22, 2013
  13. Chelu

    Chelu Member Licensed User

    Meeting the following behavior:
    - When no FaceBook account is logged in, the application crashes after requesting user and password
    - If the account is logged in, the application works perfectly
    - When I hit the url in my browser that builds the application: "" & appID & "&redirect_uri=" & RedirectUri & "&scope=" & scope & "&response_type=token" works

    What could be happening?

    On the other hand, I do not know because whenever you define a variable with appSecret, but never used.
  14. Chelu

    Chelu Member Licensed User

    A correction: never really fails when it has entered the Facebook account from the terminal
  15. Chelu

    Chelu Member Licensed User

    I really do not know when it fails ...
  16. derez

    derez Expert Licensed User

    URL not allowed ?

    I have followed the instructions, created an application in FB and hosted it in Heroku.
    I get the attached error.
    Can anyone solve it for me ?
    This is what I use:
    DataRequestLink = ""
    appID    = (from FB)
    appSecret    = (from FB)
    RedirectUri = 

    Attached Files:

  17. NJDude

    NJDude Expert Licensed User

    Do you have this uri:
    On Site URL under App Settings?
  18. derez

    derez Expert Licensed User

    I have it in "hosting URL" , but "Application Domain" is empty. What should I put there ?
  19. NJDude

    NJDude Expert Licensed User

    Your settings screen should look like THIS, read the instructions on the first post, you might be entering your info on the wrong fields.
  20. derez

    derez Expert Licensed User

    It is different !
    see attachment

    Attached Files:

  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