How to show the adview in log android .
AdView mAdView;
mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { Log.i("AdEvent: ", "onAdLoaded"); } @Override public void onAdOpened() { Log.i("AdEvent: ", "onAdOpened"); } @Override public void onAdClosed() { Log.i("AdEvent: ", "onAdClosed"); }
@Override public void onAdFailedToLoad(int errorCode) { String message = String.format("onAdFailedToLoad ", getError(errorCode)); Log.d("AdEvent", message); } });//Method to return the error codeprivate String getErrorReason( int errorCode){ switch (errorCode) { case AdRequest.ERROR_CODE_INTERNAL_ERROR: return "Internal error"; case AdRequest.ERROR_CODE_INVALID_REQUEST: return "Invalid request"; case AdRequest.ERROR_CODE_NETWORK_ERROR: return "Network Error"; case AdRequest.ERROR_CODE_NO_FILL: return "No fill"; default: return "Unknown error"; } }
After you run the app you will find the log as below
No comments:
Post a Comment