Now that we are able to authenticate against Facebook, it's time to post a photo from the gallery to our wall! To achieve this, we need to use Facebook's Graph API, making a call to the correct graph function, with the correct permissions.
Let's extend our new postToFacebook()
function by writing a new if-else statement which will take a couple of parameters and execute a Graph request against the Facebook API. Extend the postToFacebook()
function in app.js
, so that it matches the following code:
//create your facebook session and post to fb function postToFacebook() { //if the user is not logged in, do so, else post to wall if(Titanium.Facebook.loggedIn == false) { Titanium.Facebook.appid = '252235321506456'; Titanium.Facebook.permissions = ['publish_stream']; // Permissions your app needs Titanium.Facebook.addEventListener('login', function...