I’ve added a webview to my Android app so the users can like a specific Facebook page. I’ve done this using a webview as I’ve read on here and elsewhere that the Graph API doesn’t allow users to like a specific Facebook page.
However, the webview requires the user to login to Facebook the first time that they open the webview, even if they’re already logged into the Facebook app (if installed) or touch.facebook.com in the devices browser.
Is there any way around having to login? Can I import any Facebook cookie(s) from the browser into my app in any way, for example?
If I added the Graph API to my app and saved the app’s key hash at Facebook, would the user still need to log in once the webview was opened?
Thanks
One approach would be to get an instance of the WebView cookie manager and copy its cookies into your HTTP client cookie store, so that the HTTP client uses the cookies set by the login when subsequently talking to Facebook. Something like this…
Note that getCookie only gets the cookie’s name=value portion, so you will have to add in the domain name and path for the cookie to work in the HTTP client.
Another approach would be to use the Single Sign On (SSO) option on the Facebook SDK authorize function, which will not require a user login if the Facebook app is present and logged in.