本文整理汇总了Java中com.google.android.gms.ads.AdView.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java AdView.destroy方法的具体用法?Java AdView.destroy怎么用?Java AdView.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.ads.AdView
的用法示例。
在下文中一共展示了AdView.destroy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroyAd
import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
public static void destroyAd(Activity activity) {
if (!AD_ENABLED) {
return;
}
View adLayout = activity == null ? null : activity.findViewById(R.id.ad_layout);
if (adLayout != null) {
AdView adView = (AdView) adLayout.findViewById(R.id.ad);
if (adView != null) {
try {
adView.removeAllViews();
adView.destroy();
} catch (Throwable t) {
MTLog.w(TAG, t, "Error while destroying ad view!");
}
}
}
adLoaded = null;
TaskUtils.cancelQuietly(setupAdTask, true);
setupAdTask = null;
}
示例2: onDestroy
import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
if (bp != null) {
bp.release();
}
if (!Monetize.isAdsRemoved()) {
for (AdView adView : adViewTiers) {
if (adView != null) {
adView.destroy();
}
}
}
}
示例3: destroyAdView
import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
public void destroyAdView(int id, Activity activity) {
AdView adView = window.getAdView(id, activity);
if (adView != null) {
adView.destroy();
Log.d(TAG, "ad destroyed");
}
}
示例4: onPurchasesUpdated
import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
@Override
public void onPurchasesUpdated(@BillingClient.BillingResponse int responseCode, List<Purchase> purchases) {
if (responseCode == BillingClient.BillingResponse.OK && purchases != null) {
if(getView() != null) {
// Apply preference
SharedPreferences settings = getActivity().getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("donationPurchased", true);
editor.apply();
// Destroy Ad
AdView mAdView = getActivity().findViewById(R.id.adView);
mAdView.setVisibility(GONE);
mAdView.destroy();
showDonatorStatus();
}
} else if (responseCode == BillingClient.BillingResponse.USER_CANCELED) {
// Handle an error caused by a user cancelling the purchase flow.
if(getView() != null) {
Snackbar.make(getView(), R.string.donation_cancelled, Snackbar.LENGTH_SHORT).show();
}
} else {
// Handle any other error codes.
if(getView() != null) {
Snackbar.make(getView(), R.string.donation_cancelled, Snackbar.LENGTH_SHORT).show();
}
}
}
示例5: onDestroy
import com.google.android.gms.ads.AdView; //导入方法依赖的package包/类
public void onDestroy() {
for (AdView adView : adViewList) {
adView.destroy();
}
compositeDisposable.clear();
}