Creating AdMob Component Dynamically

104 Views Asked by At

I am having a trouble about Smartface App Studio about creating AdMob component dynamically. How can i do this in Smartface? In former edition, we could use AdMob component in toolbar. It was easy just drag&drop.

So in the new version, i need an example for both (Android and iOS, btw is any difference for both?) about my problem.

Thanks in advance. Regards.

1

There are 1 best solutions below

0
On

AdMob component should be added dynamically in your application.

You can create it like;

var admob = new SMF.UI.AdMob();
admob.adSize = SMF.UI.AdMob.AdSize.banner;
admob.adUnitId.Android  = "AD_UNIT_ID_Android";
admob.adUnitId.iOS= "AD_UNIT_ID_iOS";
Pages.Page1.add(admob);
var adRequest = new SMF.UI.AdMob.AdRequest();
adRequest.addTestDevice(SMF.UI.AdMob.AdRequest.deviceIDEmulator);
adRequest.addTestDevice("DEVICE_ID");
adRequest.gender = SMF.UI.AdMob.AdRequest.genderFemale;
adRequest.birthday = new Date(2004,10,10);
adRequest.location = {latitude:41, longitude:29};

//You should load it for all pages. admob.load(adRequest);

For more info please check the link : http://docs.smartface.io/?topic=html/M_SMF_UI_AdMob__ctor.htm

Smartface.io Team