- Version: 1.0.4
- GitHub: https://github.com/nstudio/nativescript-smart-adserver
- NPM: https://www.npmjs.com/package/%40nstudio%2Fnativescript-smart-adserver
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
nativescript-smart-adserver
Note: Only the Banner module is currently available in this plugin.
Works on Android and iOS
Screenshots
Android
iOS
Installation
tns plugin add @nstudio/nativescript-smart-adserver
Usage
To use this plugin, you will need Site ID, Base URL of your site, Page ID and Format ID from SmartAdServer.
TypeScript
In app.ts you have to initialize the plugin
import { SmartAdBanner } from "@nstudio/nativescript-smart-adserver";
SmartAdBanner.init(104808, "https://mobile.smartadserver.com");
Then in the xml file, include this namespace on the parent component of where you want to place the AdView.
xmlns:sas="@nstudio/nativescript-smart-adserver"
Now you can create smart ad banner like this,
<sas:SmartAdBanner height="150"
pageId="663262"
formatId="15140"
autoRefresh="true" />
JavaScript
Same as Typescript, but the import statement will be
const SmartAdBanner = require("@nstudio/nativescript-smart-adserver").SmartAdBanner;
Angular
In main.ts you have to initialize the plugin
import { SmartAdBanner } from "@nstudio/nativescript-smart-adserver";
SmartAdBanner.init(104808, "https://mobile.smartadserver.com");
In the module where you want to add Ads (eg, app.module.ts), import it like this\
import { NativescriptSmartAdBannerModule } from "@nstudio/nativescript-smart-adserver/angular";
Now add NativescriptSmartAdBannerModule
to the imports array of that module
You can now use the banner using this markup
<SmartAdBanner height="150"
pageId="663262"
formatId="15140"
autoRefresh="true"></SmartAdBanner>
API
Banner Module API (XML/HTML element Properties)
- pageId - the page id assigned by smart ad server
- formatId - format id given by smart ad server
- autoRefresh - specific if the ad should change over time
License
Apache License Version 2.0, January 2004