Android 版 Meta Audience Network SDK 的變更記錄和版本說明。
必要行動:將 Android 應用程式更新為 SDK 6.5,以便繼續在 Audience Network 上透過這些應用程式營利
您必須將 Android 應用程式更新為 Audience SDK 6.5 或以上版本,以便繼續在 Audience Network 經營事業並營利。較舊的 Audience Network SDK 與指定 Android 12 以上(API 等級 31 以上)的應用程式不相容,因此無法在這些裝置的應用程式上正常運作。
IllegalStateException
問題。/apex/com.android.art/lib64/libart.so (art::OatHeader::IsDebuggable() const+124)
問題。java.lang.IllegalStateException: Software rendering doesn't support hardware bitmaps
問題。pc 00000000000830f0 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)
當機的 Android OS 錯誤。ClassNotFoundException when unmarshalling
當機問題。為所有廣告格式推出新的彈性 API。這讓用戶可以使用建立工具物件指定各種自訂參數來載入和顯示廣告,此工具可透過 Ad.buildLoadConfig()
方法呼叫取得。舊版 API 在近期仍受支援,但最終會被移除。
IntersitialAd ad = new InterstitialAd(Context, String); ad.loadAd(ad.buildLoadConfig() // LoadConfigBuilder .withBid(String) .withListener(AdListener) .withCacheFlags(CacheFlags) .build()); // builds LoadConfig
更改網絡和快取邏輯以提高效能。
我們已更改混合型廣告受眾的標示,從 isChildDirected
更改為 MixedAudience
。請在此查看更多有關混合型廣告受眾和《美國兒童網絡私隱保護法》(Children's Online Privacy Protection Act,COPPA)的資訊:
withPreloadedIconView
,允許選擇預先快取原生廣告的圖示素材。必須指定寬度和高度。NativeAdBase .buildLoadAdConfig() // NativeAdBase.LoadAdConfigBuilder .withBidPayload(String) .withCacheFlags(MediaCacheFlags) .withPreloadedIconView(int w, int h) .loadAd();
loadAd()
要求(如已載入其他邀請),或者對廣告物件提出次要 showAd()
要求(如螢幕上已顯示廣告)。NativeBannerAd
的 ImageView
和 MediaView
現可互換。ImageView
與 NativeBannerAd
原生橫額廣告現可透過 ImageView
建立。為實現這一點,我們已加入一些新方式(如下所示)。請注意,我們仍支援使用 MediaView
。
class NativeBannerAd { /** * Registers the given view as the container and the required ImageView as the Icon display * for this NativeBannerAd to handle impressions and clicks. * ImageView must be within the view passed as the container for this NativeBannerAd. * Applies a click handler to the entire unit. * @param view the View containing this NativeBannerAd for display * @param iconView ImageView to display Icon for this NativeBannerAd * * @since 5.4 */ public void registerViewForInteraction(View view, ImageView iconView); /** * Registers the given view as the container and the required ImageView as the Icon display * for this NativeBannerAd to handle impressions and clicks. * ImageView must be within the view passed as the container for this NativeBannerAd. * Applies a click handler to the entire unit. * @param view the View containing this NativeBannerAd for display * @param iconView ImageView to display Icon for this NativeBannerAd * @param clickableViews a list of all view elements that should handle taps on this unit * * @since 5.4 */ public void registerViewForInteraction( View view, ImageView iconView, @Nullable final List<View> clickableViews); }
我們的 Android SDK 現使用新快取以儲存下載的廣告。這種新快取更為可靠,而且可減少快取錯誤。
我們現在提供可在 Kotlin 中使用 Meta Audience Network SDK 的應用程式範例。
Exoplayer 不再是 SDK 的相依項目。
RecyclerView
全螢幕顯示時大於預期的圖示。NativeBannerAd
的用戶介面執行緒中執行 I/O。BidderTokenProvider.getBidderToken()
,而且一開始便預先計算好出價者憑證。這樣一來,SDK 初始化後,您獲取出價者憑證的速度將勝於之前的版本,從而避免延遲問題。AudienceNetworkAds
中的新方法(isInitialized
)可讓應用程式測試 SDK 是否已完成初始化。如此一來,發佈商便能避免重複初始化程序。AudienceNetworkAds
中的新方法(getAdsProcessName
)可讓應用程式檢查目前進程是否為內部 SDK 進程(與 5.1 所推出的 isInAdsProcess
相同)。如果發佈商想更好地控制應用程式的進程,則此方法可用於篩選由廣告 SDK 產生的進程。NativeAdViewAttributes
建構函式現在需要使用 Context 物件。AdOptionsView
中隱藏廣告舉報圖示的選項。MediaView
(原生廣告)的影片模糊背景效果。Fatal Exception: android.util.AndroidRuntimeException: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
Android 錯誤。Error: java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebView methods must be called on the same thread.
異常問題。AdOptionsView
。Error: java.lang.RuntimeException: Unable to pause activity {com.your.app/com.facebook.ads.AudienceNetworkActivity}: java.lang.NullPointerException
項目。java.lang.NoSuchMethodError: android.view.ViewTreeObserver.removeOnGlobalLayoutListener
異常問題。java.lang.IllegalStateException: The specified child already has a parent
異常問題。