Reputation:
Just wondering if the following is possible:
(A) App loads a login page hosted on remote server using webview (Android) / browserfield (BBerry) (B) Authentication takes place at the web page housed in webview / browserfield (C) After successful login - some params are passed back from the webpage and used in subsequent screens in the app.
Thanks in advance
Upvotes: 0
Views: 693
Reputation: 308
for blackberry
//sample code in html.
function passData() {
makeblackberry.pass('Hello','1234');
}
// in blackberry class
_browserField.extendScriptEngine("makeblackberry.pass",
new ScriptableFunction() {
public Object invoke(Object thiz,final Object[] args)
{
// here args will give you params passed by javascript
//function
// args[0] = Hello and args[1] = 1234
//TODO do your task here...
return thiz;
}
});
Upvotes: 0
Reputation: 628
on android:
You can expose javascript interfaces on your webview. This allows you to define a callback in java and call it from the page loaded after the user logged in.
Flow:
create your interface with addJavascriptInterface
[1]
app opens webview
user logs in
webserver returns a page with js calling your exposed interface passing the variables/values you want
application continues
[1] http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)
Upvotes: 1