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

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: https://developers.facebook.com/apps/ (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

NOTES:

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.

Enjoy!!
 

Attachments

  • FacebookCamSample.zip
    9.8 KB · Views: 2,302

RiverRaid

Active Member
Licensed User
Longtime User
Hi!

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!
 

luke2012

Well-Known Member
Licensed User
Longtime 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 ?
 

metrick

Active Member
Licensed User
Longtime 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 "http://m.facebook.com/login.php" to browser and is working.
The only things I changed are appID and appSecret.
:sign0085:
 

kamalkishor

Member
Licensed User
Longtime 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.
 

carchek

Member
Licensed User
Longtime User
Last edited:

Chelu

Member
Licensed User
Longtime 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: "https://m.facebook.com/dialog/oauth?client_id=" & 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.
 

Chelu

Member
Licensed User
Longtime User
A correction: never really fails when it has entered the Facebook account from the terminal
 

derez

Expert
Licensed User
Longtime 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:
B4X:
DataRequestLink = "https://graph.facebook.com/me/feed"
appID    = (from FB)
appSecret    = (from FB)
RedirectUri = "https://www.safe-ridge-1264.herokuapp.com/"
Thanks
 

Attachments

  • problem.png
    problem.png
    43.3 KB · Views: 542

derez

Expert
Licensed User
Longtime User
I have it in "hosting URL" , but "Application Domain" is empty. What should I put there ?
 

derez

Expert
Licensed User
Longtime User
It is different !
see attachment
 

Attachments

  • problem2.png
    problem2.png
    16 KB · Views: 597
Top