I spent ages with the oAuth code samples getting an app to send a simple tweet before I realised that there is an extremely simple way of doing, with no need to register your app with Twitter or use access keys. Use Twitter Web Intents (see the developer pages on the Twitter website for more details).
As well as the text parameter you can also use url via hashtag
The text and url parameters should be URL encoded. The user signs in to their twitter account in the web popup which then shows them the message (which can be edited) and the Tweet button.
You’ll want to make the web popup less than full-screen to allow for a button to close the popup and return to your app. The user doesn’t have to log in next time you call the popup so it’s great for quickly posting scores etc. during a game.
Simple as that!
Stefan [import]uid: 2646 topic_id: 9695 reply_id: 309695[/import]
Thanks, Peach. I’ve been trying a similar thing with Facebook, using the Dialog URL (details here http://developers.facebook.com/docs/reference/dialogs/). It works rather well and also allows the user to edit their post. You need to set the display parameter to touch so that the dialog fits the screen nicely. If you’re not logged on then you get the login dialog first.
Hi Stefan,
I tried the Twitter and Facebook codes and they work.
But there is one thing that doesn’t work properly.
After posting a twitter message the window closes correctly but after posting the Facebook message the popup window stays and displays the content of my website.
As mentioned in my previous post, you need to make the popup window less than full-screen to leave a space to put a button that can be used to cancel the popup after posting your message. This is also useful if the user decides not to post the message or if there is a connection problem.
Hope that helps!
Stefan [import]uid: 2646 topic_id: 9695 reply_id: 42603[/import]
I made it smaller and put the close button there.
I just wasn’t sure if it’s the right behavior that my web site appears in the web popup after the facebook message is sent. I wish the web popup would close itself as it does in the twitter case.
Thanks a lot!,
Dusan
[import]uid: 5411 topic_id: 9695 reply_id: 42606[/import]
I can’t remember the exact behaviour but I thought you had to manually close the web popup for both the Twitter and Facebook examples. If you want this to happen automatically then I think you’ll need to use the oAuth approach.
Stefan [import]uid: 2646 topic_id: 9695 reply_id: 42608[/import]
I haven’t tested out the Facebook and Twitter examples on Android yet (I’ve only recently got an Android device) but I can’t see any reason why they should not work. The code is essentially the same as is used to create simple website widgets, and is based on Facebook and Twitter documentation, with the Corona web popup acting as the medium.
I would suspect that the most likely cause of any failure would be not having the appropriate Internet permissions in the build.settings file. I can’t recall the exact format details off the top of my head but there are several references to the settings required elsewhere on the Ansca forums and reference pages.
I’ll try and have a go myself but let me know if you have any success.
Stefan [import]uid: 2646 topic_id: 9695 reply_id: 42755[/import]
Twitter intents sometimes close the window, and sometimes they don’t!!! Sometimes I get an ad for the Twitter iPad app, sometimes something else. Argh!!!
I built a close button and a background rect to hide the screen. That means, sometimes I’m left with a blank screen and a close button. Sure, it works, but it isn’t elegant!!!
Argh, I say. [import]uid: 37366 topic_id: 9695 reply_id: 46784[/import]
Unsure which version that was, I think a a two-week old “daily”. I’ve just downloaded the latest daily build (2011.585). The issue seems to be on the Twitter side, what with their big ad and all. If they had a window like the Facebook window, with a close button, it might work better! [import]uid: 37366 topic_id: 9695 reply_id: 46823[/import]
(in my project the score and rank are added dynamically)
I guess facebook changed something?
It’s not working in the browser either,
so this one is not on anscas side, i guess - wich is a good thing
the twitter webPopup works perfectly, btw…
EDIT: okay facebook changed it:
[code]
message
This field will be ignored on July 12, 2011 The message to prefill the text field that the user will type in. To be compliant with Facebook Platform Policies, your application may only set this field if the user manually generated the content earlier in the workflow. Most applications should not set this.[/code]
my idea is to put the “message” into the link description section… yeah, that should work. will report after testing…
EDIT2: yes, that works quite nicely and looks even better than before [import]uid: 70635 topic_id: 9695 reply_id: 49182[/import]
this info was extremely helpful…for others looking for more information check this link on facebook about new changes in feed dialogs: http://developers.facebook.com/docs/reference/dialogs/feed/ [import]uid: 9546 topic_id: 9695 reply_id: 49278[/import]
Yes, there’s a way to encode URLs in Lua, it’s easy. First make sure you load the socket library at the beginning of your code, and then use the url.escape command, here’s an example: