Ti.Android.Admob
Ti.Android.Admob copied to clipboard
Native ads in ListView
Is is possible to implement native ads as part of listview items like after each 10 items there is native ad box?
Also looking for an answer!
I solved this for the Ti.DFP module by creating a listView template like this;
'banner': {
properties: {
height: Ti.UI.SIZE,
selectionStyle: Titanium.UI.iOS.ListViewCellSelectionStyle.NONE,
className: 'bannerRow',
name: 'bannerRow',
},
childTemplates: [
{
type: 'TiDfp.View',
bindId: 'bannerView',
properties: {
height: Ti.UI.SIZE,
adUnitId: 'xxx',
}
}
]
}
Note the "type: 'TiDfp.View'. Then you can create a new listView item, and add it where you want;
var bannerItem = [{
template: "banner",
properties: {
id: 'bannerRow',
canEdit: false,
canMove: false,
height: Ti.UI.SIZE,
accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE
},
}];
listView.sections[0].insertItemsAt(2, bannerItem, { animated : false, animationStyle: Titanium.UI.iOS.RowAnimationStyle.NONE});
I tried replacing TiDfp.View with TiAndroidAdmob.View, but this doesn't seem to work.