// It is recommended to call AdLoader.Builder on a background thread.newThread(()->{AdLoaderadLoader=newAdLoader.Builder(context,"AD_UNIT_ID").forNativeAd(newNativeAd.OnNativeAdLoadedListener(){@Override// The native ad loaded successfully. You can show the ad.publicvoidonNativeAdLoaded(@NonNullNativeAdnativeAd){}}).withAdListener(newAdListener(){@Override// The native ad load failed. Check the adError message for failure// reasons.publicvoidonAdFailedToLoad(@NonNullLoadAdErroradError){}})// Use the NativeAdOptions.Builder class to specify individual options// settings..withNativeAdOptions(newNativeAdOptions.Builder().build()).build();}).start();
// It is recommended to call AdLoader.Builder on a background thread.CoroutineScope(Dispatchers.IO).launch{valadLoader=AdLoader.Builder(context,"AD_UNIT_ID").forNativeAd{nativeAd->
// The native ad loaded successfully. You can show the ad.}.withAdListener(object:AdListener(){overridefunonAdFailedToLoad(adError:LoadAdError){// The native ad load failed. Check the adError message for failure reasons.}})// Use the NativeAdOptions.Builder class to specify individual options settings..withNativeAdOptions(NativeAdOptions.Builder().build()).build()}
[null,null,["最后更新时间 (UTC):2025-09-23。"],[],["Native ads are integrated into app layouts using platform-native UI components. Implementation involves loading ads via the `AdLoader` class and displaying them within the app. The `AdLoader` is built with listeners to specify the types of native ads to receive and handles ad loading. Use `loadAd()` for single ads or `loadAds()` for up to five. After loading, the ad or an error will be delivered to the listener. Finally, always destroy unused or dereferenced ads using the `destroy()` method to prevent memory leaks.\n"],null,[]]