Skip to content

Android WebView integration

Use Android WebView to load https://app.traveln.ai/ with silent login headers. Ensure cookies are accepted to persist sessions.

Kotlin example

val webView: WebView = findViewById(R.id.webView)
webView.settings.javaScriptEnabled = true
CookieManager.getInstance().setAcceptCookie(true)

val headers = mapOf(
  "Authorization" to "Api-Key XYZ",
  "TRAVELN-EMAIL" to "john@example.com",
  "TRAVELN-PHONE" to "+15551234567",
  "TRAVELN-FIRST-NAME" to "John",
  "TRAVELN-LAST-NAME" to "Doe"
)
webView.loadUrl("https://app.traveln.ai/", headers)

Java alternative

WebView webView = findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
CookieManager.getInstance().setAcceptCookie(true);

Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "Api-Key XYZ");
headers.put("TRAVELN-EMAIL", "john@example.com");
headers.put("TRAVELN-PHONE", "+15551234567");
headers.put("TRAVELN-FIRST-NAME", "John");
headers.put("TRAVELN-LAST-NAME", "Doe");
webView.loadUrl("https://app.traveln.ai/", headers);