Android WebView with Facebook Like functionality
Im creating a very basic Android App. All it does is renders a mobile site into a WebView. Nothing else to it...
When I'm testing the links and such I run into a problem when trying to "Like" an article through Facebook. What happens is it redirects me to login...then once I login it does nothing. I go back to my Android App and view the site and it does not register that I've "Liked" the article.
If im logged in prior to "Like" the article 开发者_开发百科it still will not mark is as liked on the mobile site. I do verify that I am logged into Facebook but its as if my App cannot read the cookies.
Has anyone had this problem, if so, do you have a fix/workaround?
Thanks
Are you able to debug the mobile site that your app is essentially wrapping? Something wrong seems to be going with the javascript being executed on the button press. Related to this, have you enabled javascript on your WebView? By default it is off and you need to use WebSettings.setJavaScriptEnabled(true).
Related to cookies, is the login occurring within your webview or is an external browser being loaded? If the later then you'll need to synchronize cookies. See:
WebView and Cookies on Android
精彩评论