2011/04/22

Study Group–Refactoring Ch.7

Refactoring - Improving the Design of Existing Code

Chapter 7 - Moving Features Between Objects

2011/04/19

Server Page Callback Mechanism in Mobile Device

Sometimes we have do some process in server side web page via the browser in Mobile App.

But, how do we handle the callback when we finish the process in server side?

Server Page Callback Mechanism in Androidimage

•How to retrieve the data which user finish the process in Server Page by using WebView in Android App?

–Extracting HTML from a WebView
http:///lexandera.com/2009/01/extracting-html-from-a-webview

•Using addJavascriptInterface

–Security issue in data transfer.

•SSL

•Use Token

–App stored the encrypted Token(including identity info)

•Encrypted Data Directly

–Encrypt callback data(confidential data) by AES.

 

•Step 1. Create an Account Handler

image

 

•Step 2. Register Handler as a JavaScript Interface

by using addJavascriptInterface.

image

 

•Step 3. Invoke Handler

image

Server Page (asp.net)

image

 

Server Page Callback Mechanism in iOSimage

1. Extract HTML DOM

–Server Page response the data with specific tag

•<Account>[email protected]</Account>

–Client App extracting DOM value by using stringByEvaluatingJavaScriptFromString.

image

•2. Intercept JavaScript window.open event.

–We can define a specific URI schema, such as “testcallback” and listen in shouldStartLoadWithRequest event.

–And define the Host name or Parameters of URI to assign different functions.

image

How to handle Callback in cross-platform?

image

My World