1

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

skaffman
  • 398,947
  • 96
  • 818
  • 769

1 Answers1

0

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

Community
  • 1
  • 1
jfelectron
  • 1,033
  • 9
  • 6
  • I've tried it both ways...with the External Browser I login and it sits there...no redirects back to the App. Then I tried maintaining it within my WebView which works to an extent...it logs me in but it wont redirect me back to my previous webview...so if I go back to the App by clicking Home then my app I can then click the Like button but its obviously not the desired functionality – Jerami Tainter Jan 05 '11 at 15:34
  • sorry...yes I'm enabling javascript...I think the best way is to maintain everything within the app and not opening the external browser. I at least can recognize the cookie. But this isn't the best user experience and not what the client is expecting. – Jerami Tainter Jan 05 '11 at 15:41
  • I agree, keeping it internal would be best. I'm stil wondering whether you can debug the javascript or other code in your web app that you are wrapping. If only to figure out exactly what headers android is passing and why things are failing. – jfelectron Jan 06 '11 at 05:36