1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    8
    Vote Rating
    -1
    bendixso is an unknown quantity at this point

      0  

    Default Post to Facebook wall from Sencha Touch App?

    Post to Facebook wall from Sencha Touch App?


    I've been trying to get this to work for a few weeks now, and I'm totally stuck. I've got a Sencha Touch app for snowboarders that generates a random line of tricks to try on some jumps. I want to have a button they can press to publish the tricks they just landed on their Facebook wall.

    Here's a screenshot from the app:


    The Facebook sharing button will go at the bottom, and that's where I'm having my problems. I'm using the FB.Connect.streamPublish() function, but it isn't prompting the user with anything.

    Some code for that:
    Code:
    var fbShare = function(){
    			
    			var message = '... just stomped ' + trickArray[1].trickString + 'to ' + trickArray[2].trickString + 'to ' + trickArray[3].trickString + 'with Snow Dice: Snowboarding';
    			
    			var attachment = {
    				'name' : 'Snow Dice: Snowboarding',
    				'href' : 'http://www.snowdiceapp.com/blog',
    				'description' : 'stomping new lines with Snow Dice App',
    				"media" : [{"type":"image","src":"http://www.snowdiceapp.com/blog"}]
    			}
    			
    			FB.Connect.streamPublish(message,attachment);
    			
    		};
    Does anyone know:
    1.) Where I should call FB.Connect.streamPublish() ?
    2.) Do I need to put all of this into some other panel for it to work?
    3.) If I need to put this into some other panel, how might I do that?

    Does anyone have:
    1.) A working Sencha Touch example where you post someone's Facebook wall?

    If so, that would be amazing. I really have no idea where to go from here.

    Thanks everyone,
    -Ted Bendixson

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    8
    Vote Rating
    -1
    bendixso is an unknown quantity at this point

      -1  

    Default Anybody there?

    Anybody there?


    Really? Nobody has tried to do this before?

  3. #3
    Sencha User
    Join Date
    Jul 2007
    Posts
    14
    Vote Rating
    -1
    m_sassa is an unknown quantity at this point

      -1  

    Default


    any news about this? i have the same problem ...

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    1
    Vote Rating
    -1
    rashers is an unknown quantity at this point

      -1  

    Default Bumping this also

    Bumping this also


    Someone has to have tried to do FB integration through Sencha Touch before?

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    -1
    keshav.jha@hemantech.com is an unknown quantity at this point

      -1  

    Default any news

    any news


    any news. I have the same problem

  6. #6
    Touch Premium Member lylepratt's Avatar
    Join Date
    Dec 2010
    Location
    Austin, Texas
    Posts
    159
    Vote Rating
    0
    lylepratt is on a distinguished road

      0  

    Default


    You'll probably have to write a server side proxy to handle Facebook interaction.
    Twitter: lylepratt

  7. #7
    Ext JS Premium Member SimonFlack's Avatar
    Join Date
    Jul 2010
    Location
    Norway
    Posts
    241
    Vote Rating
    3
    SimonFlack is on a distinguished road

      0  

    Default


    You can post on a wall using facebooks api

    https://developers.facebook.com/docs...ce/javascript/

    You can redirect to Facebooks login like this.

    <html>
    <head>
    <title>Need4Deals</title>
    <script>
    window.location = 'http://www.facebook.com/dialog/oauth?client_id=145849512154270&redirect_uri=http://www.whitefox.no/projects/m.need4deals.com/&display=touch&scope=publish_stream';
    </script>
    </head>
    <body>
    </body>
    </html>

    You have to add this to your app body

    <body>
    <div id="fb-root"></div>
    </body>

    Add Facebook api to app.

    if(!need4deals.script2){
    window.fbAsyncInit = function() {
    FB.init({appId: '145849512154270', status: true, cookie: true, xfbml: true});
    need4deals.facebook.setFBUser();
    };
    (function() {

    need4deals.script2 = document.createElement('script');
    need4deals.script2.async = true;
    need4deals.script2.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    document.body.appendChild(need4deals.script2);

    }());
    }

    And then post to wall like this.

    need4deals.facebook.wallPost = function(body){
    FB.api('/me/feed', 'post', { message: body }, function(response) {
    if (!response || response.error) {
    alert('Error occured');
    } else {
    alert('Post ID: ' + response.id);
    }
    });
    }
    Simon Flack
    CEO and UX Designer
    WhiteFox AS, Norway

    Web: www.whitefox.no

    Facebook: www.facebook.com/WhiteFoxAS

    Twitter: @WhiteFoxAS

  8. #8
    Sencha User
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    -1
    keshav.jha@hemantech.com is an unknown quantity at this point

      0  

    Default


    Are you sure if this would work for "Sencha Touch" applications for which this forum is originally posted

  9. #9
    Ext JS Premium Member SimonFlack's Avatar
    Join Date
    Jul 2010
    Location
    Norway
    Posts
    241
    Vote Rating
    3
    SimonFlack is on a distinguished road

      0  

    Default


    Yeah... We used it in an app.
    Simon Flack
    CEO and UX Designer
    WhiteFox AS, Norway

    Web: www.whitefox.no

    Facebook: www.facebook.com/WhiteFoxAS

    Twitter: @WhiteFoxAS

  10. #10
    Sencha User
    Join Date
    Aug 2011
    Posts
    4
    Vote Rating
    0
    roje is on a distinguished road

      0  

    Default Thank you SimonFlack

    Thank you SimonFlack


    I used your trick and it works great.

    But my problem is that when I use the sdk tools to build a custom js file, when accessing to the app I've got an error that says FB is not defined...

    Do you use the sdk tools to minify your app too ?

    Thanks.

Similar Threads

  1. POST request in Sencha Touch using Ajax
    By sonianand11 in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 29 May 2012, 9:23 AM
  2. Sencha Touch + Facebook Graph API
    By djd in forum Sencha Touch 1.x: Discussion
    Replies: 11
    Last Post: 28 Nov 2011, 8:38 AM
  3. Is it possible to integrate Facebook authentication into Sencha Touch
    By directx0000 in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 23 Nov 2011, 6:49 AM
  4. I'm confused about GET and POST in Sencha-touch
    By pcr in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 19 Jul 2011, 4:44 AM
  5. Not allowed to post on sencha touch forum without license?
    By pokiekokie in forum Community Discussion
    Replies: 1
    Last Post: 3 Feb 2011, 9:45 AM

Thread Participants: 9

Tags for this Thread