When developing an app in Android that includes a
WebView component, a few
additional steps are needed to ensure that Viafoura's social login capabilities function properly.
WebView component provides a subset of the functionality of the
Android Webkit browser. The
WebView's behavior deviates from regular browsers
in the way that it manages popup windows. When a popup window is opened from a link in a page within a
WebView, it is opened separately in the Android browser,
and not within the same
WebView. This breaks the continuity of the web page, and
makes it impossible to return control to the page hosted with a
WebView in the
Viafoura's social login process requires a popup window to manage the
authentication process with the appropriate social network. Once the social
network has authorized a user's credentials, the popup window is closed, and the
originating site will now be logged into Viafoura.
This document and supporting repository will provide you with clear steps on implementation.
Host an HTTPS Page that Serves the Widget
Please review MainActivity.kt for a sample implementation of Viafoura's social login.
WebView's controller must:
In the main
domStorageEnabled = true
loadsImagesAutomatically = true
blockNetworkImage = false
vii. To enable social login with Google, set:
userAgentString = "Mozilla/5.0 (Linux; Android 7.0; SM-G930V Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537 .36"
WebViewdisplaying the page
i. Implement the
onCreateWindowhandler for that
which opens a
dialog(or similar subview structure) and child
onCloseWindowto allow the
In the child
onCheckIsTextEditorto enable the soft keyboard
ii. Implement an
onPageFinishedhandler in its
The implementation of Viafoura's tools in a
WebViewcan be difficult.
Contact our support team for more information and assistance.
Updated over 1 year ago