-
Notifications
You must be signed in to change notification settings - Fork 3
Debug Web View
Jason Pell edited this page Aug 30, 2021
·
2 revisions
It used to be really easy to attach a chrome debugger to a web view to catch the initial loading, but now I cannot work out how to do it anymore. So ive resorted to the approach I use for the iOS SDK, which is to load a blank page into the view, and then prompt before loading the ad, so that the chrome debugger can be attached.
The Android SDK 1.4.3+ comes with a loadBlankPage() method which you can use in concert with code somewhat like the following, where loadAd() is the method which will actually call the adnuntius web view loadAd(...) method:
adView.loadBlankPage();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.app_name);
builder.setMessage("Click Ok to load the Ad");
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
loadAd();
}
});
AlertDialog alert = builder.create();
alert.show();
Check out https://github.com/Adnuntius/android_sdk_examples/blob/master/simple/app/src/main/java/com/adnuntius/simple/MainActivity.java for how its used.