Hi, I have a problem with a facebook like button.
In the facebook developer, facebook give us 3 differents methods to integrate the like button in our app. In this example I use all the 3 methods.
naturally first I have launched the FB.Init (for the desktop and for the App):
the final result is that on the desktop, it functions perfectly but on my android App not yet...I Don't see any like button.
Facebook like button
In the facebook developer, facebook give us 3 differents methods to integrate the like button in our app. In this example I use all the 3 methods.
I have created 3 buttons in sencha architect touch (Ext.Button). After I have created a basic function where I pass to the HTML buttons config the 3 methods
Code:
var me = this,
htmlStrBase,
htmlStr,
htmlStrBase1,
htmlStr1,
htmlStrBase2,
htmlStr2;
htmlStrBase = '<div class="fb-like" data-href="http://ift.tt/1tsyVFJ" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div>';
htmlStrBase1 = '<iframe src="//www.facebook.com/plugins/like.php?href=https://www.facebook.com/tecnitalia?ref=ts&fref=ts&width&layout=button&action=like&show_faces=false&share=false&height=35&appId=838403862859130" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true"></iframe>';
htmlStrBase2 = '<html xmlns:fb="http://ogp.me/ns/fb#"><fb:like href="http://ift.tt/1tsyVFJ" layout="button" action="like" show_faces="false" share="false"></fb:like>';
me.getLikebutton().setHtml(htmlStrBase);
me.getLikebutton1().setHtml(htmlStrBase1);
me.getLikebutton2().setHtml(htmlStrBase2);
naturally first I have launched the FB.Init (for the desktop and for the App):
Code:
if(Ext.os.is.Android || Ext.os.is.iOS) {
FB.init({
appId : 'xxxxxxxxxxxxx',
status : true,
nativeInterface: CDV.FB,
useCachedDialog: false,
xfbml : true
});
//alert('dopo FB.init');
FB.Event.subscribe('auth.statusChange', function(response) {
//alert('status changed');
});
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/it_IT/sdk.js#xfbml=1&appId=XXXXXXXXX&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
//Otherwise let's use the the web version
else
{
//Wait for sdk to load
//alert('eseguo fbAsyncInit');
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXXXX',
status : true,
xfbml : true
});
FB.Event.subscribe('auth.statusChange', function(response) {
//alert('status changed');
});
};
//alert(' after fbAsyncInit e now include SDK');
//Include SDK
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
the final result is that on the desktop, it functions perfectly but on my android App not yet...I Don't see any like button.
I say you last thing....if I copy one of this 3 methods directly in the html button config I can see the like button on my App. But I cannot copy directly this methods in the HTML config button because I need to change the facebook address each time a user logged in my App.
Somebody can help me and knows a method to integrate in my app the like button dinamically?
thank you
Carlo
Facebook like button
Aucun commentaire:
Enregistrer un commentaire