Sharing on Facebook using Feed Dialog Box in Titanium
Posted By : Akshay Luthra | 30-Jun-2015
This blog provides you a way to share on Facebook using Facebook Feed Dialog Box which gives the user a facility to share what they want to in addition to the default text that is going to be shared.
For this you need to make the entry of your Facebook app id in the “tiapp.xml” file of your app (you can see how it is done in the documentation of Appcelerator).
After doing that, use the following code to share on Facebook -
var fb = require('facebook'); fb.appid = <FB_app_id>; fb.forceDialogAuth = true; var shareData = { link : <link_to_a_site_you_want_to_share>, name : "Testing Sharing on FB", description : "Sharing on FB using its feed dialog box is very easy.", picture : <picture_you_want_to_share>, }; var shareDataOnFb = function() { if (shareData != null) { fb.dialog("feed", shareData, function(e) { try { if (e.success) { alert("Shared on Facebook"); } else if (e.cancelled) { alert("Cancelled"); } else { alert("Error occurred"); } } catch(e) { alert("Error occurred"); } }); } };
This is all you have to do.
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Akshay Luthra
Akshay Luthra has excellent experience in developing Cross Platform Mobile Apps using JavaScript and Titanium Framework. He loves listening to music and travelling new places.