Image Image Image Image Image

© Copyright 2012 ABCoder | Email | RSS

Scroll to Top

To Top

JavaScript

16

Oct
2011

2 Comments

In JavaScript
Sencha Touch

By abcoder

Invite Facebook friends from Sencha Touch app

On 16, Oct 2011 | 2 Comments | In JavaScript, Sencha Touch | By abcoder

Recently I’ve been working on a Sencha Touch project which is based on facebook api. A very simple feature is to invite facebook friends to this app. I was ransacking into the facebook api docs, other websites to figure out how to do it from Sencha Touch. There is a PhoneGap plugin for this but we’re not going to use PhoneGap for this one. I need a very simple php based solution. First I tried a lot to do it from php sdk. Cos according to the application’s design the user will select his friends from a sencha touch list, click a button and the selected records will be passed to backend php script via Ext.Ajax.request. After spending several hours on this I figured out it is not possible to invite friends to app from php sdk! Grrr..

Now the only way left is javascript. Most people are still using fbml for this and I tried it first, it didn’t work and you know fbml is deprecated by facebook anyway. Next javascript sdk. Requests Dialog is the proper way of doing this.

function sendRequestToManyRecipients() {
  FB.ui({method: 'apprequests',
    message: 'My Great Request',
  }, requestCallback);
}


From iPhone this won’t look good. You need to add display:’touch’ with it and call the function from your sencha touch button’s handler.

function sendRequestToManyRecipients() {
  FB.ui({method: 'apprequests',
    message: 'My Great Request',
    display:'touch',
  }, requestCallback);
}

That’s it! Here is how it looks from iPhone 4:
Facebook friend invitation to application requests dialog from sencha touch app

Tags | , , , , , , , ,

Comments

  1. yesitsme

    you’ve been working on loads of different projects. BESIDE THE ONES YOU GOT PAID FOR.

  2. Hi all Sencha Touch,
    thank u for ur reply me but i try to update it, but it still got error that I have meet one problem that need u again help me, I want to get Json Data format from web url http://townhub.bmsolution.biz/mysql2json-2010-11-07/example.php , but i have got error invalid label
    [Break On This Error] “data”: [
    here is my code:
    index.html

    Getting Started

    app.js
    // JavaScript Document
    Ext.application({
    name: 'Sencha',
    launch: function() {
    Ext.create('Ext.DataView', {
    fullscreen: true,
    store: {
    autoLoad: true,
    //i have update fields like this
    //fields: ["from_user", "text", "profile_image_url"],
    /*—i have change to */
    fields:["id","cust_firstname","cust_lastname","cust_email"],

    proxy: {
    type: ‘jsonp’,
    //url: ‘http://search.twitter.com/search.json?q=Sencha Touch’,
    //url: ‘http://search.twitter.com/search.json?q=fakecriterions&callback=myCallbackFunction’,
    url:’http://townhub.bmsolution.biz/mysql2json-2010-11-07/example.php’,
    reader: {
    type: ‘json’,
    root: ‘data’
    }
    }

    },
    });

    }
    });
    Sorry Chris Herdt and all Dev Pls check it again for me cos i realy need for find solution for my project that nearly Dateline

    I have got en Error from fire bug like this sms:invalid label
    [Break On This Error] “data”: [

    thax for advance that reply me back……….i doing waitting Reply—

Submit a Comment