Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azerion/cordova-ads

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azerion/cordova-ads

Cordova plugin for Azerion Ads SDK

  • 2.0.0-rc.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Integration

Execute the following command to integrate the plugin:

cordova plugin add @azerion/cordova-ads

AdMob configuration

Android

Add the AdMob APPLICATION_ID into /platforms/android/app/src/AndroidManifest.xml

    <application>
        ...
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
            ...
    </application>

iOS

Update your app's Info.plist file to add a GADApplicationIdentifier key with a string value of your AdMob app ID.

<key>GADApplicationIdentifier</key>
	<string>ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY</string>

Initialize Azerion Ads SDK

// Initiate SDK initialization
// App should use its own machanism to get user consent to use personal data (such as AdID) to serve ads
// If isDebugModeEnabled is true then SDK will log network call operation
azerionAds.initialise(gdprConsentString, isCOPPACompliant, withUserConsent, isTestModeEnabled, isDebugModeEnabled);

// Recive the initialization status
azerionAds.on('InitializationCompleted', (initializationStatus) => {
    console.log(initializationStatus);
});

Sample initializationStatus response:

{
    // AdMob
    "com.google.android.gms.ads.MobileAds": {
        "description": "",
        "name": "com.google.android.gms.ads.MobileAds",
        "state": "READY"
    },
    "ImproveDigital": {
        "description": "",
        "name": "ImproveDigital",
        "state": "READY"
    }
}

NOTE You can only request Ad after SDK successfully finished initialization. In production build isTestModeEnabled and isDebugModeEnabled should be false.


Banner Ad

// Request banner ad
azerionAds.requestBanner("azerionAdUnitId", AzerionAds.AdBannerPosition.BOTTOM, AzerionAds.AdBannerSize.BANNER);

// Show the banner and start refresh  timer
azerionAds.showBanner();

// Hide the banner and stop refresh timer
azerionAds.hideBanner();

// Listening Banner Events

azerionAds.on('BannerOnReceiveAd', () => {
});

azerionAds.on('BannerOnFailedToReceiveAd', (error) => {
});

azerionAds.on('BannerOnDisplay', () => {
});

azerionAds.on('BannerOnHide', () => {
});

azerionAds.on('BannerOnLeftApplication', () => {
});

Interstitial Ad

// Request Interstitial Ad 
azerionAds.requestInterstitial("adUnitId");

// Listening Interstitial Ad Events
azerionAds.on('InterstitialOnAdLoaded', () => {
    azerionAds.showInterstitial();
});

azerionAds.on('InterstitialOnAdFailedToLoad', (error) => {
        // If you want to load another ad
    azerionAds.requestInterstitial("adUnitId");
});

azerionAds.on('InterstitialOnAdDisplayed', () => {
});

azerionAds.on('InterstitialOnAdFailedToDisplay', (error) => {
        // If you want to load another ad
    azerionAds.requestInterstitial("adUnitId");
});

azerionAds.on('InterstitialOnAdClosed', () => {
    // If you want to load another ad
    azerionAds.requestInterstitial("adUnitId");
});

azerionAds.on('InterstitialOnAdLeavingApplication', () => {
});

Rewarded Ad

azerionAds.requestRewardVideo("azerionAdUnitId");

// Listening Rewarded Ad Events
azerionAds.on('RewadedVideoOnAdLoaded', () => {
    azerionAds.showRewardVideo();
});

azerionAds.on('RewadedVideoOnAdFailedToLoad', (error) => {
    // If you want to load another ad
    azerionAds.requestRewardVideo("azerionAdUnitId");
});

azerionAds.on('RewadedVideoOnAdDisplayed', () => {
    
});

azerionAds.on('RewadedVideoOnAdFailedToDisplay', (error) => {
    // If you want to load another ad
    azerionAds.requestRewardVideo("azerionAdUnitId");
});

azerionAds.on('RewadedVideoOnAdClosed', () => {
    // If you want to load another ad
    azerionAds.requestRewardVideo("azerionAdUnitId");
});

azerionAds.on('RewadedVideoOnAdLeavingApplication', () => {
});

azerionAds.on('RewadedVideoOnUserRewardEarned', (rewardItem) => {
    console.log("rewarde amount: " + rewardItem.amount);
});
  • Kotlin module issue

    More than one file was found with OS independent path 'META-INF/annotation-experimental_release.kotlin_module'
    

    Please add the following config into .../platforms/android/app/build.gradle

    android {
        ...
        packagingOptions {
            exclude("META-INF/*.kotlin_module")
        }
        ...
    }
    
  • If you are using firebase-analytics please update it version to 21.0.0

Keywords

FAQs

Package last updated on 10 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc