AdMob API and keywords

被刻印的时光 ゝ 提交于 2019-12-12 11:26:20

问题


Does anyone manage to get relevant advertisement from AdMob server when setting keywords or search query ? My application runs on Android and I manage to retrieve ads from the AdMob server.

I try several solutions but they do not seem to work.


Solution 1: use the methods setKeywords( String keywords ) or setSearchQuery( String searchQuery ) from the AdView class and then, call requestFreshAd(). When a request is currently in progress, a call to requestFreshAd() generate the following message in log :

"WARN/AdMobSDK(2541): Ignoring requestFreshAd() because we are requesting an ad right now already."

.

Thus, I try to call requestFreshAd() when no request are in progress but it doesn't work anymore.


Solution 2: In the XML layout, use the attributes myapp:keywords="myKeywords" on the AdView element. This attributes is previously declared in the attrs.xml file.


回答1:


ADMob SDK will automatically request new add based on the set refresh rate. I think that the default is 60s. So, you don`t have to call requestFreshAd() at all. Run your app from from Eclipse, go to activity where the adds are, and watch logcat window. Periodically you will see that adds are fetched automatically, based on that refresh rate setting. You can change that refresh rate on http://www.admob.com/my_sites and than clicking 'Manage settings' on an app, and 'App settings'. Also, you can simply set a refresh interval with the refreshInterval attribute on the AdView element in your layout XML file.



来源:https://stackoverflow.com/questions/5066129/admob-api-and-keywords

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!