Before we get underway testing methods, I wondered would be the best way to go about capturing public data from tweets? I'm thinking http.request
through Twitter's API...?
Many thanks in advance,
Fixdit Team
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Before we get underway testing methods, I wondered would be the best way to go about capturing public data from tweets? I'm thinking http.request
through Twitter's API...?
Many thanks in advance,
Fixdit Team
http://developer.anscamobile.com/content/network-0
http://apiwiki.twitter.com/w/page/22554679/Twitter-API-Documentation
I like network.request,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | local function networklistener(event) if ( event.isError ) then print( "Request Error" ) else response = json.decode( event.response ) if response["results"] then local tweet = response["results"][1]["text"] print( tweet ) end end end --Search for yobonja on twitter network.request("http://search.twitter.com/search.json?q=yobonja", "GET", networklistener) |
Thanks for that Angelo,
really useful. Is there a way to access Twitter's stream API successfully? Finding the documentation of oAuth Library in the code exchange ( http://developer.anscamobile.com/code/oauth-library ) to be really shakey.
Hm, I'm not sure ~ I haven't used the stream API. It looks like Basic Auth still works for it though.
Also, if don't need to post to a users account or deal with a user in any way, you can just get your OAuth Access Token from dev.twitter.com
Then it seems like network.request will work with that just fine, but yeah I haven't tried it.
-Angelo
A bit about Twitter and their use of authentication:
"Mobile and Desktop applications are most often single user applications such as command line scripts and applications on a phone. For these applications it can be difficult to handle a callback URL if not impossible.
So...
"If you can handle a callback in your application we strongly encourage you use OAuth to authorize users. If not you should consider Out-of-band/PIN code authentication"
... I would use the PIN method, but this is no good because you would need to have a Twitter account to use the app and sign off the URL each time. I need the Stream API to work in the background ...
"The least desired way to authenticate with Twitter is xAuth. This method is only available to desktop or mobile applications and you need to request permission to use it. It is important to understand that xAuth is still OAuth. The only difference being that you skip the request_token and authorize steps of the OAuth flow."
... The way I see it, in order to use Twitter content without the user having to make any particular action that breaks the flow of the app is to use xAuth. Let me know if this doesn't sound right or have further suggestions.
Many thanks,
I think that if you get them to sign into twitter once, you'll be okay (for a while, I don't know when the authentication expires) - you can actually handle OAuth in Corona SDK via the web popup, so the PIN method isn't necessary.
But what in general is you application about? Do you need a user to sign in at all?
-Angelo