Documentation Index

Fetch the complete documentation index at: https://academy.insiderone.com/llms.txt

Use this file to discover all available pages before exploring further.

SDK Initialization

Prev Next

Since the WebView library is an extension to core functionality, you need to initialize native SDKs just as before in order to start using the library:

Insider.Instance.init(this, "<your-partner-name>"); // ^^Android
Insider.initWithLaunchOptions(launchOptions, partnerName: "<your-partner-name>", appGroup: "<app-group>") // ^^iOS

After that, you can wrap your webView instance to have the library intercept calls made from web page:

Possibly in one of the activity class in your app, you can do the following:

import com.useinsider.insiderwebview.InsiderWebView;

final class AppWebViewActivity extends AppCompatActivity {
  
  private WebView webView;
  
  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    InsiderWebView.INSTANCE.setupWebViewSDK(webView); // ^^ 
  }
}

or in the view controller class if it is an iOS application:

import InsiderWebView

final class AppViewController: UIViewController {

  @IBOutlet weak var webView: WKWebView!
    
  override func viewDidLoad() {
    super.viewDidLoad()
    Insider.setupWebViewSDK(on: webView) // ^^
  }
}

The wrapping mechanism dynamically injects a proxy object that exposes the public methods of the native SDKs via the window.insider object once the DOM is fully loaded.

const insiderID = await window.insider.getInsiderID();
console.log(insiderID);