The document discusses how to integrate Twitter into Titanium mobile apps. It provides instructions on setting up a Twitter application, linking necessary Github libraries, and including the required code to make GET and POST requests to the Twitter API using OAuth authentication. The presentation notes some known issues like inconsistent OAuth support across platforms and provides alternatives to Twitter integration like using custom app URLs. It concludes by thanking the audience and providing links for further reading.
26. Ti.include('lib/sha1.js');
Ti.include('lib/oauth.js'); code in your
Ti.include('lib/oauth_adapter.js');
Ti.include('lib/twitter_api.js'); app.js
// First check for authentication
var tState = oa.oAuthAdapter.isAuthorized();
if (tState != false) {
oa.oAuthAdapter.send({
url:'http://api.twitter.com/1/account/verify_credentials.json',
parameters:[
],
method:'GET',
onSuccess:function(response){
response = JSON.parse(response);
// Do something with the response data
alert(response);
},
onError:function(response){
response = JSON.parse(response);
// Do something with the response data
alert(response);
}
}); GET
}
London Titanium Meetup - June 2011 @ketan
27. // First check for authentication code in your
var tState = oa.oAuthAdapter.isAuthorized();
app.js
if (tState != false) {
oa.oAuthAdapter.send({
url:'https://api.twitter.com/1/statuses/update.json',
parameters:[
['display_coordinates','true'],
['lat',latitude],
['long',longitude],
['include_entities',1],
['status', someText]
],
method:'POST',
onSuccess:function(response){
response = JSON.parse(response);
// Do something with the response data
alert(response);
}
}); POST
}
London Titanium Meetup - June 2011 @ketan
28. Known Issues
Android
Browser Password Dialog
iOS & Android
xAuth
Messy Codebase
Using other Social Networks
London Titanium Meetup - June 2011 @ketan
29. Alternatives
Custom URLs
Built in porotocol handlers registered by Apps
Surrey Police App
SCI-FI-LONDON
London Titanium Meetup - June 2011 @ketan