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) {
				} else {
					alert("Error occurred");
			} catch(e) {
				alert("Error occurred");

This is all you have to do.


About Author

Author Image
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.

Request for Proposal

Name is required

Comment is required

Sending message..