How to let a user post to FaceBook / Twitter?

DevBaby

Active Member
Licensed User
Longtime User
For my App, I want to allow users to post their progress to their Facebook status or wall. I have seen this done on Facebook with a workout app, such as “User has burned 234 calories working out today.”

I am basically looking to do the same thing; have a user post their progress on Facebook / Twitter.

1) How do I do this? Any tutorials etc.

2) I imagine that I will need to store the users login info…are there concerns I need to watch out for…encryption etc? If so where are some tutorials on the subject?

Thanks for any help / direction with this.
 

DevBaby

Active Member
Licensed User
Longtime User
Thanks for the links.

However, there doesn’t seem to be (and I may have missed it) a conclusive method for posting a Facebook text base message. One of the liked threads seems to have stopped at the point of trying to get it to work.

Also for Facebook, several tutorials (or thread links) speak about first creating an app on Facebook. Does this mean that each user of ‘my’ would have to do so, or that I can create ‘one’ app on Facebook and use this ‘one’ app (on Facebook) as the carrier for all other users who send their messages through the app (basic4android) that I am creating?

Basically, I am confused as to purposes of creating an app on Facebook.
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
Facebook only allows registrated apps
to interact with Facebook accounts and pages.


You create the one APP

Users would have to allow your FB APP permissions to POST to their FB wall
 
Last edited:
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
Post to Facebook Wall with B4

Here is a modified version of: steve05/vb1992/njdude's code

to just post a message to a Facebook Wall via the Facebook Graph with b4a

This will allow a user with your app to post progress type messages to their Facebook wall.



.
 

Attachments

  • FaceBookWall.zip
    8.5 KB · Views: 1,025
Last edited:
Upvote 0

DevBaby

Active Member
Licensed User
Longtime User
Hi, I tried the code in the FaceBookWall.zip, but I was looking for a way that an automatic message is sent on the users behalf to their wall...such as "user has scored 100 points on Game X."

I am not sure where in the code that a message is automatically sent, it seems that a webview opens for the user to type a message.

I could be wrong and just not understand what I am looking at.
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
I believe once the user gives your facebook app permission
via your b4a android app and that code, then you can
auto post things to the wall without always asking for
permission.
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
You would just need to modify "sub PostWall"

postwall("Jim has scored 100 points on Game X.")

B4X:
postwall("Jim has scored 100 points on Game X.")

Sub PostWall (MyMessage as string)


   'Add Description
       Dim nv As Map
    
   nv.Initialize
       nv.Put("message", MyMessage )
    
       req = MultipartPost.CreatePostRequest(DataRequestLink & "?access_token=" & AccessToken, nv, Null)
      hc.Execute(req, 1)
 
End Sub
 
Upvote 0

derez

Expert
Licensed User
Longtime User
I created an application in facebook, using the heroku site.
I gave vb1991's application the same name and run it, after inserting the ID, secret and site url.
I don't get the "works!" message in my facebook wall.
When I install the application it does not request any special permission for facebook (other then internet access).
Help ?
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Checking again what I have:
after performing this line
B4X:
FacebookPage.LoadUrl("https://m.facebook.com/dialog/oauth?client_id=" & appID & "&redirect_uri=" & RedirectUri & "&scope=" & scope & "&response_type=token")
I get the facebook page loaded with nothing but an "Error" header (blue background), underneath it a message: " an error occurred, Please try again later"

Can someone tell me how to correct it ?
thanks
 
Last edited:
Upvote 0

squaremation

Active Member
Licensed User
Longtime User
I try to run example, but all that happens is facebook login pops up for about 1-2 seconds and the disappears. :(
 
Upvote 0

ckapucu

Member
Licensed User
Longtime User
It disappears. To prevent this, disable the first code row FacebookPage.Visible = False in Sub FacebookPage_PageFinished(Url As String)
 
Last edited:
Upvote 0

MaxApps

Active Member
Licensed User
Longtime User
Is it possible to post pictures and links (e.g. link to my apps on google play)?

Kind regards
Jakob
 
Upvote 0

pierosso

Member
Licensed User
Longtime User
is there someone able to write a library for using facebook sdk for native login to connect with facebook with just one click (without inserting login data)?
most of the applications currently on the market allow to do that.
 
Upvote 0
Top