WebView Instrumentation (JavaScript Agent Injection)

WebView Instrumentation automatically injects our Javascript Agent into your WebViews, so that WebView navigation can also be instrumented. By default, Ajax calls are disabled, however, both WebView instrumentation, and Ajax instrumentation can be configured using the properties JsAgentEnabled and JsAgentAjaxEnabled:

Example

CODE
var config = AppDynamics.Agent.AgentConfiguration.Create("<#Your App Key#>");
config.JsAgentEnabled = true;
config.JsAgentAjaxEnabled = false;
AppDynamics.Agent.Instrumentation.InitWithConfiguration(config);

Note

WebViews are automatically instrumented on Xamarin iOS. To use WebView instrumentation on Xamarin Android, you have the following options:

  1. Use the InstrumentedWebView : AppDynamics.Agent.Forms.InstrumentedWebView .
  2. Export our renderer globally for the Xamarin.Forms.WebView or your custom WebView.
CODE
[assembly: ExportRenderer(typeof(WebView), typeof(AppDynamics.Droid.InstrumentedWebViewRenderer))]

You can do this in the Android project, above MainActivity:

JAVA
[assembly: ExportRenderer(typeof(WebView), typeof(AppDynamics.Droid.InstrumentedWebViewRenderer))]
namespace MyProject.Droid
{
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
...
}
}