Question

I've been playing a while with the latest release of Facebook's SDK for Android. In particular, I've been trying out the Native Ad API. My problem is I want to be able to preload several ads (lets say 3 or 5 or 10, doesn't matter), so they appear the instant they appear on screen. I've managed to do this but I've got stuck with the images. Apparently, the images (icon and coverImage) can only be obtain via the NativeAd.downloadAndDisplayImage which requires the imageView where the images will be displayed.

Is there anyone having this same kind of issue? Anyone who has played/worked with the Native Ad API in Android and can give me some insight?

It's kinda difficult since I can't look into the source code of the AudienceNetwork library yet, plus there's no javadoc. I've tried googling around but with no success.

Was it helpful?

Solution

NativeAd.downloadAndDisplayImage is just a helper to make download and display images easier. You can get url and dimension of the ad icon/image from NativeAd.getAdIcon() and NativeAd.getAdCoverImage(). Then you can do prefetching using the urls.

If you download the latest Facebook SDK for Android, Audience Network javadoc is available under AudienceNetwork/docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top