GithubHelp home page GithubHelp logo

liangyongxiong / cordova-plugin-admob-baidu Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 11.85 MB

cordova plugin for Baidu MSSP ads

Home Page: https://www.npmjs.com/package/cordova-plugin-admob-baidu

License: MIT License

Java 30.99% Objective-C 66.72% JavaScript 2.29%
cordova admob baidu mssp plugin

cordova-plugin-admob-baidu's Introduction

Baidu Admob for MSSP / Cordova Plugin

release platforms qq

通过 Javascript 调用百度广告联盟(MSSP)SDK 接口,渲染广告内容

官方 SDK 下载:

NPM

https://www.npmjs.com/package/cordova-plugin-admob-baidu

Installation

通过 Cordova Plugins 安装

$ cordova plugin add cordova-plugin-admob-baidu

通过 URL 安装

$ cordova plugin add https://github.com/liangyongxiong/cordova-plugin-admob-baidu.git

Usage

YOUR_APP_ID : 应用媒体ID

YOUR_POSITION_ID : 广告位ID

横幅广告(Banner)

align : 显示位置(top-顶部,bottom-底部)

var banner = cordova.BaiduAdMob.BannerAd.show({
    app: YOUR_APP_ID,
    position: YOUR_POSITION_ID,
    align: 'bottom',
}).addEventListener('onSuccess', function(event) {
    console.log('Baidu AdMob banner onSuccess');
    setTimeout(function() {
        banner.hide();
    }, 3000);
}).addEventListener('onError', function(event) {
    console.log('Baidu AdMob banner onError');
}).addEventListener('onClose', function(event) {
    console.log('Baidu AdMob banner onClose');
}).addEventListener('onClick', function(event) {
    console.log('Baidu AdMob banner onClick');
});

插屏广告(Interstitial)

type : 插屏类型(1-其它,2-视频播放前倒计时,3-视频播放中暂停)

var interstitial = cordova.BaiduAdMob.InterstitialAd.show({
    app: YOUR_APP_ID,
    position: YOUR_POSITION_ID,
    type: 3,
}).addEventListener('onSuccess', function(event) {
    console.log('Baidu AdMob interstitial onSuccess');
    setTimeout(function() {
        interstitial.hide();
    }, 5000);
}).addEventListener('onError', function(event) {
    console.log('Baidu AdMob interstitial onError');
}).addEventListener('onClose', function(event) {
    console.log('Baidu AdMob interstitial onClose');
}).addEventListener('onClick', function(event) {
    console.log('Baidu AdMob interstitial onClick');
});

开屏广告(Splash)

bottom : 底部填充区域,包括图片路径和填充区域高度(单位:dp)

var splash = cordova.BaiduAdMob.SplashAd.show({
    app: YOUR_APP_ID,
    position: YOUR_POSITION_ID,
    bottom: {
        image: 'images/bottom.jpg',
        height: 120,
    },
}).addEventListener('onSuccess', function(event) {
    console.log('Baidu AdMob splash onSuccess');
}).addEventListener('onError', function(event) {
    console.log('Baidu AdMob splash onError');
}).addEventListener('onClose', function(event) {
    console.log('Baidu AdMob splash onClose');
}).addEventListener('onClick', function(event) {
    console.log('Baidu AdMob splash onClick');
});

Feeds联盟(Feeds)

cordova.BaiduAdMob.FeedsAd.url({
    app: YOUR_APP_ID,
    channel: YOUR_CHANNEL_ID
}).addEventListener('onSuccess', function(event) {
    console.log('Baidu AdMob feeds onSuccess');

    // Feeds联盟接入URL
    alert(event.url);
}).addEventListener('onError', function(event) {
    console.log('Baidu AdMob feeds onError');
});

FAQ

Empty

Support

Contribute

Please contribute! Look at the issues.

License

This project is licensed under MIT.

cordova-plugin-admob-baidu's People

Contributors

liangyongxiong avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

waitaction

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.