2using System.Diagnostics;
3using GoogleMobileAds.Api;
16 public abstract partial class GoogleAdUnit<TAd>
21 public DateTime?
LoadTime {
get;
protected set; }
23 private long? loadingStartTimestamp;
53 private void SetLoadingTime()
56 ? (long)((Stopwatch.GetTimestamp() - startTimestamp) * 1000d / Stopwatch.Frequency)
58 loadingStartTimestamp =
null;
65 protected virtual void OnAdPaid(AdValue adValue)
68 base.OnAdPaid(adValue);
77 base.OnAdImpressionRecorded();
100 base.OnAdLoadFailed(error);
137 base.OnAdContentFailed(error);
148 base.OnUserEarnedReward(reward);
override double AmountAsDouble
Concrete adapter that wraps an SDK-specific reward object and exposes it through the SDK-agnostic AdR...
virtual LogOptions LogOptions
override void OnAdImpressionRecorded()
Handles the ad impression recorded event, logging the impression.
virtual void OnAdLoadFailed(LoadAdError error)
Handles the ad load failed event, logging the error encountered during ad loading.
override void OnAdLoaded()
Handles the ad loaded event, setting the load time, preparing the ad object for display,...
void SetLoadingStartTime()
Saves the start time of an ad-loading request.
long? LoadingTimeMs
Gets the duration of the latest successful ad-loading request in milliseconds. Divide the value by 10...
virtual void OnAdContentFailed(AdError error)
Handles the ad content failed event, logging the error encountered while displaying the ad content.
override void OnAdShown()
Handles the ad shown event, logging that the ad has been displayed to the user.
override void OnAdClosed()
Handles the ad closed event, logging that the ad was closed by the user.
virtual void PrepareAdObject()
Optional overridable method for setting up the AdObject. This can be used for initializing or customi...
DateTime? LoadTime
Date and time when the ad was loaded.
void ResetLoadingStartTime()
Clears the saved start time when an ad-loading request cannot be started.
virtual void OnAdPaid(AdValue adValue)
Handles the event when an ad generates revenue, logging the ad's value and currency code.
virtual void OnUserEarnedReward(AdReward reward)
Handles the user earned reward event, logging the type and amount of the reward earned through intera...
override void OnAdClicked()
Handles the ad clicked event, logging that the ad was interacted with by the user.