Overview
Skill Level: Any
Prerequisites
Before you begin, you must:
- Install and implement the most recent Acoustic Experience Analytics (Tealeaf) Android SDK.
- Include the most recent UI Capture j2 JavaScript source file.
Step-by-step
-
Add WebView to your application.
Specify a length, height, weight, and ID that suits your application:
<WebView
android:id="@+id/my_webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" /> -
In your activity, locate the WebView and load your HTML file:
public class MainActivity extends ActionBarActivity {
private UICWebView mUICWebView;
private String logicalPageName = "BridgeAppActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
// Initialize tealeaf with a reference to application
Tealeaf tealeaf = new Tealeaf(this.getApplication());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Load HTML file from local resource in the UICWebview
mUICWebView = (UICWebView) findViewById(R.id.uic_webview);
// Modify the Url for your hybrid app
mUICWebView.loadUrl("file:///android_asset/www/test.html");
WebSettings webSettings = mUICWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
} -
Copy the application’s HTML and JavaScript files to the /assets/www folder in your Android project.