Wiki

Clone wiki

AATKit Corona Sample / Home

aatkit.*


Type library Keywords ads, advertising, aatkit Availability Enterprise


Overview

The aatkit plugin offers easy integration of mobile ad networks. AddApptr gives you access to all the networks with one single SDK.

Sign Up

To use the AddApptr SDK, please sign up for an account.

Platforms

  • Android: Yes
  • iOS: Yes
  • Mac: No
  • Win: No
  • Kindle: No
  • NOOK: No

Ad networks version

list

Syntax

local aatkit = require "plugin.aatkit"

Functions

init()

initWithTestMode()

setDebugEnabled()

setDebugShakeEnabled()

getVersion()

isNetworkEnabled

setNetworkEnabled

setInitialRules

enableRulesCaching()

Placements

createPlacement()

startPlacementAutoReload()

stopPlacementAutoReload()

reloadPlacement()

setPlacementSubId()

Banner only

addPlacementToView()

removePlacementFromView()

startPlacementAutoReloadWithSeconds()

setPlacementAlignment()

setPlacementPosition()

Fullscreen only

showPlacement()

Promo specials

enablePromo()

disablePromo()

preparePromo()

showPromo()

PROPERTIES

Banner size

AATKitBanner320x53

AATKitBanner768x90

AATKitBanner300x250

AATKitFullscreen

AATKitBannerAuto

Banner alignment

AATKitBannerAlignTopLeft

AATKitBannerAlignTopCenter

AATKitBannerAlignTopRight

AATKitBannerAlignBottomLeft

AATKitBannerAlignBottomCenter

AATKitBannerAlignBottomRight

AATKit events

AATKitHaveAd

AATKitNoAds

AATKitPauseForAd

AATKitResumeAfterAd

AATKitShowingEmpty

AATKitUserEarnedIncentive

Project Settings

SDK

All versions of Corona SDK below Enterprise are not supported.

Enterprise

iOS

  1. Download and unpack AATKit_Corona.zip
  2. Open your Corona SDK project in Xcode.
  3. Copy the libcom_intentsoftware_addapptr.a library and plugin_aatkit folder from coronaEnterprisePlugin_iOS to your project.
  4. In Xcdoe select your project target. Switch to "Build Phases" tab and open "Link Binary With Libraries".
  5. Click on plus button -> Add Other, locate libcom_intentsoftware_addapptr.a file you just added to your project and add it.
  6. You must also add several Frameworks to your project:
        Accounts
        AdSupport
        AssetsLibrary
        AudioToolbox
        AVFoundation
        CFNetwork
        CoreGraphics
        CoreImage
        CoreLocation
        CoreMedia
        CoreMotion
        CoreTelephony
        EventKit
        EventKitUI
        iAd
        imageIO
        MediaPlayer
        MessageUI
        MobileCoreServices
        QuartzCore
        SafariServices
        Security
        Social
        StoreKit
        SystemConfiguration
        Twitter
        libsqlite3
        libxml2
        libz
    
  7. In the same "Build Phases" tab find "Copy Bundle Resources" and add all files located in plugin_aatkit folder.

iOS Application Transport Security - ATS

Due to the fact that many ad network SDKs aren't ATS compliant yet, it's recommended to disable ATS. ATS Configuration

Android Required files

You don't need to import all files if you are not using all ad networks. Before integration check what files are required by ech ad network. (ANDROID Files List)

Android

  1. Download and unpack AATKit_Corona.zip
  2. Open your Corona SDK project in Eclipse.
  3. Locate folder "libs" in you project or create it and copy .jar files from coronaEnterprisePlugin_Android/libs to your libs folder.
  4. In Eclipse, choose File->Import->Existing Android Code Into Workspace. As root directory provide coronaEnterprisePlugin_Android folder. Select Ad network projects that you will be using. Also check "copy projects into workspace" and click Finish.
  5. Right click on your project, select Properties->Android. In Library section click Add, select new added projects and click Ok.
  6. Copy 'assets' and 'etc' folder into you project root directory and merge with existing folders.
  7. Open AndroidManifest.xml located in your project root directory and add required permissions:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    
    Note that android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION are not obligator*.

  8. Define activities in AndroidManifest.xml

            <!-- ads start -->
                <!-- Google Play Services -->
                    <meta-data
                        android:name="com.google.android.gms.version"
                        android:value="@integer/google_play_services_version" />
    
                <!-- ADMOB("AdMob"), ADX("AdX", "RTB2"), DFP("DFP") -->
                    <activity
                        android:name="com.google.android.gms.ads.AdActivity"
                        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    
                <!-- MILLENNIAL("Millennial") -->
                    <activity
                        android:name="com.millennialmedia.internal.MMActivity"
                        android:configChanges="keyboardHidden|orientation|keyboard"
                        android:theme="@android:style/Theme.NoTitleBar" >
                    </activity>
                    <activity
                        android:name="com.millennialmedia.internal.MMIntentWrapperActivity"
                        android:label="sdk" />
    
                <!-- SMARTSTREAMTV("Smartstream.tv", "GroupM") -->
                    <activity
                        android:name="com.video.adsdk.internal.ADActivity"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
                    <activity
                        android:name="com.video.adsdk.internal.BrowserActivity"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    
                <!-- INMOBI("Inmobi") -->
                    <activity
                        android:name="com.inmobi.androidsdk.IMBrowserActivity"
                        android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
                        android:hardwareAccelerated="true"
                        android:theme="@android:style/Theme.NoTitleBar" />
    
                <!-- ADDAPPTR("House") -->
                    <activity android:name="com.intentsoftware.addapptr.fullscreens.PromoHouseFullscreenActivity" >
                    </activity>
    
                <!-- SMARTAD("SmartAdServer") -->
                    <activity
                        android:name="com.intentsoftware.addapptr.fullscreens.SmartAdServerFullscreenActivity"
                        android:configChanges="orientation|screenSize" >
                    </activity>
    
                <!-- MDOTM("MdotM") -->
                    <activity
                        android:name="com.mdotm.android.view.MdotMActivity"
                        android:launchMode="singleTop" />
                    <activity
                        android:name="com.mdotm.android.vast.VastInterstitialActivity"
                        android:configChanges="keyboardHidden|orientation"
                        android:theme="@android:style/Theme.NoTitleBar" >
                    </activity>
    
                <!-- APPLOVIN("AppLovin") -->
                    <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
                    <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
    
                <!-- MOBFOX("MobFox") -->
                    <activity
                        android:name="com.adsdk.sdk.banner.InAppWebView"
                        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
                    <activity
                        android:name="com.adsdk.sdk.video.RichMediaActivity"
                        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
                        android:hardwareAccelerated="false" />
    
                <!-- APPLIFT("AppLift") -->
                    <activity
                        android:name="com.applift.playads.PlayAdsActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:taskAffinity="com.applift.playads" />
    
                <!-- NEXAGE("Nexage", "RTB1") -->
                    <activity android:name="com.intentsoftware.addapptr.fullscreens.NexageFullscreenActivity" >
                    </activity>
    
                <!-- SMAATO("Smaato") -->
                    <activity android:name="com.intentsoftware.addapptr.fullscreens.SmaatoFullscreenActivity" >
                    </activity>
    
                <!-- PLAYHAVEN("PlayHaven") -->
                    <activity
                        android:name="com.playhaven.android.view.FullScreen"
                        android:configChanges="orientation|keyboardHidden|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar"
                        android:windowSoftInputMode="adjustResize" >
    
                        <!-- Support FullScreen.createIntent -->
                        <intent-filter>
                            <action android:name="android.intent.action.VIEW" />
    
                            <category android:name="android.intent.category.DEFAULT" />
                        </intent-filter>
                        <!-- Support Uri.parse -->
                        <intent-filter>
                            <action android:name="android.intent.action.VIEW" />
    
                            <category android:name="android.intent.category.DEFAULT" />
    
                            <data
                                android:host="localhost"
                                android:pathPattern="/full"
                                android:scheme="playhaven" />
                        </intent-filter>
                    </activity>
    
                <!-- APPRUPT("Apprupt") -->
                    <activity
                        android:name="com.apprupt.sdk.CvInterstitialActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
                    <activity
                        android:name="com.apprupt.sdk.CvOverlayActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
                    <activity
                        android:name="com.apprupt.sdk.CvExpandActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
                    <activity
                        android:name="com.jirbo.adcolony.AdColonyOverlay"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
                    <activity
                        android:name="com.jirbo.adcolony.AdColonyFullscreen"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
                    <activity
                        android:name="com.jirbo.adcolony.AdColonyBrowser"
                        android:configChanges="keyboardHidden|orientation|screenSize"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    
                <!-- FACEBOOK("Facebook") -->
                    <activity
                        android:name="com.facebook.ads.InterstitialAdActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize" />
    
                <!-- UNITYADS("Unity") -->
                    <activity
                        android:name="com.unity3d.ads.android.view.UnityAdsFullscreenActivity"
                        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
                        android:hardwareAccelerated="true"
                        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    
                <!-- LOOPME("LoopMe") -->
                    <activity
                        android:name="com.loopme.AdActivity"
                        android:configChanges="orientation|keyboardHidden|screenSize"
                        android:hardwareAccelerated="true"
                        android:theme="@android:style/Theme.Translucent" />
                    <activity android:name="com.loopme.AdBrowserActivity" />
    
                <!-- AMAZON("Amazon") -->
                    <activity
                        android:name="com.amazon.device.ads.AdActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize" />
    
                <!-- MOPUB("MoPub") -->
                    <activity
                        android:name="com.mopub.mobileads.MoPubActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize" />
                    <activity
                        android:name="com.mopub.mobileads.MraidActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize" />
                    <activity
                        android:name="com.mopub.common.MoPubBrowser"
                        android:configChanges="keyboardHidden|orientation|screenSize" />
                    <activity
                        android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
                        android:configChanges="keyboardHidden|orientation|screenSize" />
    
                <!-- OPENX("OpenX") -->
                    <activity
                        android:name="com.openx.sdk.browser.AdBrowserActivity"
                        android:configChanges="orientation|screenSize|keyboardHidden"
                        android:theme="@android:style/Theme.NoTitleBar"
                        android:windowSoftInputMode="adjustPan|stateHidden" >
                    </activity>
            <!-- ads end -->
    

Facebook Audience Network Integration

Android

  1. Download and unpack Facebook SDK
  2. Locate folder "libs" in you project and copy "FacebookSDK/AudienceNetwork/bin/AudienceNetwork.jar" to your libs folder.

iOS

  1. Download Facebook SDK
  2. Go to your projects settings and select the Build Phases -> Link Binary With Libraries.
  3. Press + button and add FBAudienceNetwork.framework locatet in Facebook SDK directory. By default the Facebook SDK is installed into your home directory: /User/yourUserName/Documents/FacebookSDK
  4. Check whether your library search path includes the absolute path to the Facebook Audience Network Framework. Choose the Build Settings tab, also in your project settings. Search for the Library Search Paths row, by using the search text field. Specify the absolute path of the FBAudienceNetwork.framework for the linker.

Usage guide

Initialize AATKit and add events

#!lua
local aatkit = require "plugin.aatkit"

function libraryCallback( event )
    if event.id == AATKitHaveAd then
        print("AATKitHaveAd")
        print( event.placement )
    elseif event.id == AATKitNoAds then
        print("AATKitNoAds")
        print( event.placement )
    elseif event.id == AATKitShowingEmpty then
        print("AATKitShowingEmpty")
        print( event.placement )
    elseif event.id == AATKitPauseForAd then
        print("AATKitPauseForAd")
    elseif event.id == AATKitResumeAfterAd then
        print("AATKitResumeAfterAd")
    elseif event.id == AATKitUserEarnedIncentive then
        print("AATKitUserEarnedIncentive")
        print( event.placement )
    end
end

function scene:create( event )
    aatkit.init( libraryCallback )
end

Create placements and start autoreloading

#!lua
local aatkit = require "plugin.aatkit"

local bannerId = "BannerPlacement"
local interstitialId = "FullscreenPlacement"

function scene:create( event )
    -- banner placement
    aatkit.createPlacement( bannerId, AATKitBannerAuto )
    aatkit.startPlacementAutoReload( bannerId )

    -- fullscreen placement
    aatkit.createPlacement( interstitialId, AATKitFullscreen )
    aatkit.startPlacementAutoReload( interstitialId )

end

Show fullscreen placement

#!lua
aatkit.showPlacement( interstitialId )
Please note that calling the method showPlacement does increase the AdSpace count, which is used to calculate the fill rate. An AdSpace expresses the intention to show an ad. To ensure correct reporting of existing AdSpaces, it is advised to call the showPlacement method each time you want to display an interstitial - no matter whether the event OnHaveAd occurred or not.

Rewarded videos

The integration steps for rewarded videos are the same as for other fullscreen ads (they also use the same AATKitFullscreen). You will just need to give this placement some specific name, like

#!lua
aatkit.createPlacement( interstitialId, AATKitFullscreen )
and send this name to support@addapptr.com, indicating that you want to use it for rewarded videos. When the user watches the rewarded video and incentive is earned, the libraryCallback function will be called with event id:
#!lua
AATKitUserEarnedIncentive

Promo ads

In addition to classic banner and fullscreen ads, AATKit can be used to display special "promo" ads- they can be used, for example, to advertise your other applications. Promo is displayed in the form of fullscreen ad that would appear automatically no more than once per hour. The integration is extremely simple, just call:

#!lua
    aatkit.enablePromo()
to enable automatic display of promotional ads. If you want to stop displaying promotional ads, just call:
#!lua
    aatkit.disablePromo()
If you don't want to use automatic promo call:
#!lua
    aatkit.preparePromo()
and then:
#!lua
    showPromo()
to manually show promo screen.

Sample Code

You can access sample code here.

Updated