Wondering what’s next for npm?Check out our public roadmap! »

    cordova-plugin-admob-tomitank

    4.1.2 • Public • Published

    Cordova AdMob Plugin

    Created for iOS 14 AppTrackingTransparency.

    This plugin use cocoapods for iOS dependencies!

    Usage:

    Use directly with iOS 14 AppTrackingTransparency module (recommended)

    admob.interstitial.config({ id: admobid.interstitial, isTesting: false, autoShow: false });
    
    admob.banner.config({ id: admobid.banner, overlap: true, isTesting: false, autoShow: true });
    
    admob.getTrackingStatus().then(function(status) { // get status..
    
        if (status == 'notDetermined') { // not determined..
    
            navigator.notification.confirm(LANGUAGE.tracking_info_msg, function() { // open a native popup for infos..
    
                admob.trackingStatusForm().then(function(status) { // iOS tracking form..
    
                    // show ads..
    
                    if (status != 'authorized') { // not authorized show a motivation popup.. (optional)
    
                        // navigator.notification.confirm..
                    }
                });
    
            }, LANGUAGE.tracking_info, [LANGUAGE.okay]);
    
        } else { // determined..
    
            // show ads..
    
            if (status != 'authorized') { // not authorized show a motivation popup.. (optional)
    
                // navigator.notification.confirm..
            }
        }
    });
    

    OR Use with User Messaging Platform SDK (not recommended - 2020.09.22)

    admob.userMessagingPlatform().then(function(result) {
        alert(result);
    }).catch(function(error) {
        alert(error);
    }).then(function() { // load ads in every case..
        // load + show ads..
    });
    

    for iOS you need to add the following to config.xml:

    <config-file platform="ios" target="*-Info.plist" parent="SKAdNetworkItems">
          <array>
            <dict>
                <key>SKAdNetworkIdentifier</key>
                <string>cstr6suwn9.skadnetwork</string>
            </dict>
        </array>
    </config-file>
    <config-file platform="ios" target="*-Info.plist" parent="NSUserTrackingUsageDescription">
        <string>This lets us show your personalized ads, which keeps the app for free</string>
    </config-file>
    

    Difference against the admob-free plugin:

    All prepare() functions return the ad id!

    admob.banner.prepare().then(function(ad_id) {});
    admob.interstitial.prepare().then(function(ad_id) {});
    

    Result:

    1. AppTrackingTransparency: This plugin return the AppTrackingTransparency status name. So you can write extra notification for user. Info: https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager/authorizationstatus
    2. User Messaging Platform: Error callback: umpError, formError Success callback: noSharedInstance, formStatusNotAvailable, obtained, notObtained, keepTheForm

    Support:

    If you want to support please write here: tanky.hu@gmail.com

    ENJOY!

    Install

    npm i cordova-plugin-admob-tomitank

    DownloadsWeekly Downloads

    10

    Version

    4.1.2

    License

    MIT

    Unpacked Size

    132 kB

    Total Files

    26

    Last publish

    Collaborators

    • avatar