Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native ads in ListView #19

Open
qasim90 opened this issue Apr 2, 2020 · 1 comment
Open

Native ads in ListView #19

qasim90 opened this issue Apr 2, 2020 · 1 comment

Comments

@qasim90
Copy link

qasim90 commented Apr 2, 2020

Is is possible to implement native ads as part of listview items like after each 10 items there is native ad box?

@arifje
Copy link

arifje commented Sep 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants