Menny
Menny

Reputation: 473

How to pass data from webview back to the native Android app

Our Android app has a WebView which shows a page from our web-server. The page does a user registration (either via Facebook or by choosing a username and password). After that, I want the page to pass information back to the native app (e.g., username, license type, messges, etc.).

I know of JavaScript<->Java binding (addJavaScriptInterface), but was wondering is there a different way do to it:

Upvotes: 5

Views: 1627

Answers (1)

saxman
saxman

Reputation: 1975

After the user logs in, you can capture data from the URL using WebView::getUrl(). Alternately, you could use cookies.

http://pragungoyal.com/tutorials/extracting-cookies-from-a-webview-in-android/

Upvotes: 1

Related Questions