I am developing facebook like button to integrate with my application.Here is the html code copied from developers.facebook.com
<html>
<body>
<div id="fb-root"></div>
<script>
(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#xfbml=1&appId=my_app_id";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<fb:like data-href="http://www.facebook.com/facintegra" data-send="true" data-width="450" data-show-faces="false" data-font="tahoma"/>
</body>
My android activity code
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.loadUrl("file:///android_asset/FacebookLikeView.html");
m_cObjFacebook = new Facebook("Your_id");
authorizefacebook();
}
private void authorizefacebook(){
m_cObjFacebook.authorize(this, m_cPermissions, new DialogListener() {
@Override
public void onComplete(Bundle values) {
m_cAccessToken = values.getString(Facebook.TOKEN);
}
@Override
public void onFacebookError(FacebookError error) {
System.out.println(error.toString());
}
@Override
public void onError(DialogError e) {
System.out.println(e.toString());
}
@Override
public void onCancel() {
System.out.println("Cancel");
}
});
}
}
When application starts it checks whether I am logged in to the facebook or not. If not, it displays facebook log-in screen to log-in and then after log-in successful, it goes to my facebook page instead of my android app page.
If it founds me logged in, then it gives the screen as below.
Please help me where i am going wrong
First screen of my app
the screen after clicking the OK button
when clicking the like button in my webview, its redirecting to the link facebook.com/connect/connect_to_external_page_reload.html. Please help me what should I do?
Thanks