-
26 Apr 2011 6:45 AM #1
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:
Does anyone know: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); };
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
-
5 May 2011 7:24 AM #2
Anybody there?
Anybody there?
Really? Nobody has tried to do this before?
-
9 May 2011 1:00 PM #3
any news about this? i have the same problem ...
-
26 Aug 2011 1:01 AM #4
Bumping this also
Bumping this also
Someone has to have tried to do FB integration through Sencha Touch before?
-
9 Sep 2011 12:31 AM #5
any news
any news
any news. I have the same problem
-
9 Sep 2011 6:13 AM #6
You'll probably have to write a server side proxy to handle Facebook interaction.
Twitter: lylepratt
-
9 Sep 2011 1:56 PM #7
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
-
13 Sep 2011 1:30 AM #8
Are you sure if this would work for "Sencha Touch" applications for which this forum is originally posted
-
13 Sep 2011 1:34 AM #9
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
-
16 Feb 2012 7:30 AM #10
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
-
POST request in Sencha Touch using Ajax
By sonianand11 in forum Sencha Touch 1.x: DiscussionReplies: 3Last Post: 29 May 2012, 9:23 AM -
Sencha Touch + Facebook Graph API
By djd in forum Sencha Touch 1.x: DiscussionReplies: 11Last Post: 28 Nov 2011, 8:38 AM -
Is it possible to integrate Facebook authentication into Sencha Touch
By directx0000 in forum Sencha Touch 1.x: DiscussionReplies: 4Last Post: 23 Nov 2011, 6:49 AM -
I'm confused about GET and POST in Sencha-touch
By pcr in forum Sencha Touch 1.x: DiscussionReplies: 4Last Post: 19 Jul 2011, 4:44 AM -
Not allowed to post on sencha touch forum without license?
By pokiekokie in forum Community DiscussionReplies: 1Last Post: 3 Feb 2011, 9:45 AM


Reply With Quote