Giter Club home page Giter Club logo

cordova-plugin-fbanfree's Introduction

Cordova Facebook Audience Network Free

This Plugin uses the lastest version of Facebook Audience Network SDKs for Android and iOS to monetize the Audience Network ads on your Hybrid application

Free
Definition of free in English by oxforddictionaries:
1. Able to act or be done as one wishes; not under the control of another.
2. Not or no longer confined or imprisoned.
...
5. Given or available without charge.
and so on

This plugin is inspired by AdMob Plus

Installation

cordova plugin add cordova-plugin-fbanfree

Important(iOS)

This Plugin uses cordova-plugin-cocoapod-support to generate the Podfile to match the min ios version in pod file. You must check at yourprojectDir/config.xml before using this plugin

add this

<platform name="ios">
    ...
    <preference name="pods_ios_min_version" value="11.0"/>
    ...
</platform>

Prerequisite(Android)

The Audience network Android SDK requires the android.support:recyclerview suppoort library. Before the installation please check the version of your project recyclerview and add another --variable to the cordova plugin add

The default uses 27+

cordova plugin add cordova-plugin-fbanfree --variable ANDROID_SUPPORT_RECYCLERVIEW_VERSION=20+

Usage

To show the banner use:

fbanfree.showBanner('YOUR_PLACEMENT_ID)
.then(res => {
    console.log('banner show success', res);
}).catch(err => {
    console.log('err showing banner', err);
});

To hide the banner use:

fbanfree.hideBanner('YOUR_PLACEMENT_ID')
.then(res => {
    console.log('banner hide success', res);
}).catch(err => {
    console.log('err hiding banner', err);
});

To show the Native ad (right now can only show at fullwidth with custom margin top, I'll add more option later):

const data = {
    placementID: 'YOUR_PLACEMENT_ID',
    position: {
        top: 220
    }
}
fbanfree.showNative(data)
.then(res => {
    console.log('native show success:', res);
})
.catch(err => {
    console.log('error showing native:', err);
});

To Hide the specific Native use:

fbanfree.hideNative('YOUR_PLACEMENT_ID')
.then(res => {
    console.log('native hide success', res);
}).catch(err => {
    console.log('err hiding native', err);
});

To Hide ALL Native ads use:

fbanfree.hideAllNative()
.then(res => {
    console.log('native hide all success', res);
}).catch(err => {
    console.log('err hiding all native', err);
});

To show the Interstitial ad:

fbanfree.showInterstitial('YOUR_PLACEMENT_ID')
.then(res => {
   console.log('interstitial show success:', res);
})
.catch(err => {
   console.log('error showing interstitial:', err);
});

To show the Rewared Video:

fbanfree.showRewardedVideo('YOUR_PLACEMENT_ID')
.then(res => {
   console.log('rewarded video show success:', res);
})
.catch(err => {
   console.log('error showing rewarded video:', err);
});

License

cordova-plugin-fbanfree's People

Contributors

wichanan avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

gostrafx

cordova-plugin-fbanfree's Issues

Support banner position = "top"

Please support banner display "top" in fbanfree.showBanner(). (Default seems to be bottom, and can't be overridden yet?) I would definitely use this right away - thank you! :)

Banner loads empty/grey rectangle

Thank you for publishing -- this cordova plugin is much-needed and appreciated, as alternative plugins have been broken for a long time. :(

I'm trying fbanfree.showBanner(). Banner seems to execute OK (then() is called), but banner displays as an empty grey rectangle (Android). I can't seem to debug this further. Any way we could access "load", "load_failed" events for more detail in JavaScript, e.g. I tried this, but the event doesn't fire...

document.addEventListener('fban.banner.load', function(data) { ... });
document.addEventListener('fban.banner.load_fail', function(data) { ... });

java.lang.ClassCastException: fban.plugin.ads.BannerAd cannot be cast to

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cordova.ionic, PID: 14886
java.lang.ClassCastException: fban.plugin.ads.BannerAd cannot be cast to fban.plugin.ads.FBInterstitialAd
at fban.plugin.ads.FBInterstitialAd$1.run(FBInterstitialAd.java:28)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

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.