Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Webview and Facebook Login Not working

I am having a problem with a WebView app that I am working on.

We have this responsive website that is being displayed through an android WebView.

The website has a Sign in with Facebook option, this works fine in a mobile browser and on the website itself. Whenever I try to use the WebView app to login using Facebook, it results in a white screen.

I am having difficulties finding a solution to get this to work.

Appreciate any advise.

like image 598
Gayan Hewa Avatar asked May 21 '14 17:05

Gayan Hewa


People also ask

Does Facebook use WebView?

Our in-app browser for Facebook on Android has historically relied on an Android System WebView based on Chromium, the open source project that powers many browsers on Android and other operating systems.

Is Android WebView a browser?

You may have come across an app called Android System WebView on your smartphone. It's a piece of software that enables other apps on your Android device to display web content without having to open a dedicated web browser.


2 Answers

I was able to find a solution based on a previous question on stackoverflow.com

Making facebook login work with an Android Webview

Here is a link to my MainActivity : http://pastebin.com/KdzfhqDJ

like image 103
Gayan Hewa Avatar answered Oct 17 '22 15:10

Gayan Hewa


I'm fairly certain it's this same issue. Essentially it opens in another window and WebView doesn't support multiple windows out-of-the-box.

Luckily for you, unlike that question which was iOS-specific, if I recall correctly, it's possible to extend WebView to support multiple windows. You'll need to extend WebChromeClient, implement onCreateWindow and use it in your WebView.

like image 3
kabuko Avatar answered Oct 17 '22 16:10

kabuko