Wiki

Clone wiki

Xamarin_Binding_Sample_App / Home

Overview

The aatkit binding project 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.

Changelog

Ad networks version list


GDPR - General Data Protection Regulation

Using the CMP through AddApptr provided wrapper

With the introduction of IAB TCF2.0, AddApptr will no longer act as a CMP. Instead, we provide wrappers allowing for easily integrating third-party CMPs. Please note that the CMPs need a server-side configuration, please contact support@addapptr.com if you need support.

CMP Implementations

For now, we provide two CMP implementations:

CMP Google

Android requires Xamarin.Google.UserMessagingPlatform package and appId to be added to Manifest, like

#!c#
<meta-data
          android:name="com.google.android.gms.ads.APPLICATION_ID"
          android:value="YOUR-APP-ID"/>

For iOS you need to set the GADApplicationIdentifier value to the Info.plist file, like:

#!javascript
<key>GADApplicationIdentifier</key>
<string>YOUR-APP-ID</string>

Code example:

#!c#

       public MainPage()
       {
           InitializeComponent();
           binding = DependencyService.Get<IAATKitBinding>();
           binding.AATKitManagedConsentNeedsUserInterface += AATKitManagedConsentNeedsUserInterface;
        }

        public void InitAATkit()
        {
            if (binding != null)
            {
                AATKitConfiguration configuration = new AATKitConfiguration();
                configuration.consent = new AATKitManagedConsent()
                {
                    cmp = new AATKitCmpGoogle()
                };
                binding.InitAATKit(configuration);
            }
        }

        public void AATKitManagedConsentNeedsUserInterface(object sender, AATKitEventArgs e)
        {
            binding.ShowConsentDialogIfNeeded();
        }

CMP Ogury

Requires Asset Key as configuration parameter when initializing AATKit.

Code example:

#!c#

       public MainPage()
       {
           InitializeComponent();
           binding = DependencyService.Get<IAATKitBinding>();
           binding.AATKitManagedConsentNeedsUserInterface += AATKitManagedConsentNeedsUserInterface;
        }

        public void InitAATkit()
        {
            if (binding != null)
            {
                AATKitConfiguration configuration = new AATKitConfiguration();
                configuration.consent = new AATKitManagedConsent()
                {
                    cmp = new AATKitCmpOgury()
                    {
                        assetKey = "XXXX"
                    }
                };
                binding.InitAATKit(configuration);
            }
        }

        public void AATKitManagedConsentNeedsUserInterface(object sender, AATKitEventArgs e)
        {
            binding.ShowConsentDialogIfNeeded();
        }

Not using the AddApptr CMP wrapper

If for some reason you do not want to use AddApptr CMP wrappers, AATKit also provides another methods for GDPR compliance. The ConsentRequired configuration parameter allows you to inform AATKit if the user is subject to the GDPR laws:

#!c#
    configuration.consentRequired = true;

To define if the user has given or withheld consent for the collection and use of personal data (used for non-IAB partners) set AATKitSimpleConsent as consent and use nonIABConsent parameter as:

  • AATKitSimpleConsent.Consent.OBTAINED if the user has given the consent.
  • AATKitSimpleConsent.Consent.WITHHELD if the user has declined.

If SimpleConsent is used, it will automatically read the IAB Consent String stored (by third-party CMP) in SharedPreferences (if available).

#!c#
configuration.consent = new AATKitSimpleConsent()
{
    nonIABConsent = AATKitSimpleConsent.Consent.OBTAINED;
}

Adding placements

Banner ads

Fullscreen ads

Rewarded ads

Android binding

AATKitWrapper

**void OnActivityResume(Activity activity)**
Notifies AATKit about activity resume. Invoke this method in every activity that uses AATKit.

**void OnActivityPause(Activity activity)**
Notifies AATKit about activity pause. Invoke this method in every activity that uses AATKit.

**void Init(Application application, Delegate delegate) - DEPRECATED**
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void Init(Application application, Delegate delegate, bool enableRuleCaching, string initialRules) - DEPRECATED**
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void Init(Application application, Delegate delegate, int testId) - DEPRECATED** 
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void Init(Application application, Delegate delegate, AATConfiguration configuration)** 
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void EditConsent()**
Presents the consent dialog. Mostly, should be used to change initial consent settings later, for example via app settings.

**void ReloadConsent()**
Calls the CMP to reload. Does not need to be used unless some error occurs.

**void ShowConsentDialogIfNeeded()**
Presents the consent dialog if it wasn't presented before. Mostly, should be used when app starts.

**void Reconfigure(AATConfiguration configuration)** 
Updates AATKit consent arguments after the AATKit is already initialized.

**void SetDebugEnabled(bool enabled)**
Enables debug mode with additional info on Application Output.

**void SetDebugShakeEnabled(bool enabled)**
Enables debug screen that will show after shaking the device. It is already enabled by default.

**string AatkitVersion()**
AATKit version.

**string GetDebugInfo()**
Collect debug information about AATKit.

**bool IsNetworkEnabled(AdNetwork network)**
Returns true if ad network is enabled, false otherwise.

**void SetNetworkEnabled(AdNetwork network, boolean enabled)**
Allows to enable or disable selected ad networks. By default all networks are enabled.

**int CreatePlacement(string placementName, PlacementSize placementSize)**
Creates placement with given name and size.

**void StartPlacementAutoReload(int placementId)**
Enables automatic reloading of placement. Autoreloader will use reload time configured on addapptr.com account or fallback to default 30 seconds.

**void StopPlacementAutoReload(int placementId)**
Disables automatic reloading of placement.

**bool ReloadPlacement(int placementId)**
Requests placement reload. Works only if automatic reloading is disabled. For banners it will not cause new banner to show more often than set banner refresh interval (default: 30s) - instead, it will set a timer to reload and show next ad when the refresh interval passes. To force ad reload and display before this delay, use the method ReloadPlacement(int, boolean) instead.

**bool ReloadPlacement(int placementId, bool forced)**
Requests placement reload. Works only if automatic reloading is disabled. For native ads.

**bool HasAdForPlacement(int placementId)**
Returns true if there is an ad loaded for given placementId.

**View GetPlacementView(int placementId)**
Returns placement view. Works only for banner placements.

**string GetPlacementName(int placementId)**
Returns placement name for given placement Id.

**int GetPlacementId(string placementName)**
Returns id of placement with given name, or null if placement with given name does not exist.

**bool ShowPlacement(int placementId)**
Shows interstitial ad if ad is ready.

**void SetTargetingInfo(JavaDictionary<string, IList<string>> info)**
Sets the targeting information for the application. This information will be used only if no placement-specific targeting is available.

**void SetTargetingInfo(int placementId, JavaDictionary<string, IList<string>> info)**
Sets the targeting information for the given placement. Information provided for placement overrides targeting information for application set by the setTargetingInfo(Map).

**void AddAdNetworkForKeywordTargeting(AdNetwork network)**
Adds an ad network to the list of ad networks that receive targeting keywords (if any set). If no ad networks are added, any set keywords will be delivered to all ad networks supporting keyword targeting.

**void RemoveAdNetworkForKeywordTargeting(AdNetwork network)**
Removes an ad network from the list of ad networks that receive targeting keywords (if any set). If no ad networks are added to the list, any set keywords will be delivered to all ad networks supporting keyword targeting.

Delegate

**void AatkitHaveAd(int placementId)**
Notifies that placement has finished loading an ad successfully.

**void AatkitNoAd(int placementId)**
Notifies that placement has failed to load an ad.

**void AatkitPauseForAd(int placementId)**
Notifies that ad went fullscreen and that application should pause.

**void AatkitResumeAfterAd(int placementId)**
Notifies that ad came back from fullscreen and that application should resume.

**void AatkitShowingEmpty(int placementId)**
Notifies that placement has loaded an Empty ad.

**void AatkitUserEarnedIncentive(int placementId)**
Notifies that placement has earned incentive (by rewarded ads).

**void AatkitObtainedAdRules(bool fromTheServer)**
Notifies that the AATKit has obtained ad rules.

**void AatkitHaveAdForPlacementWithBannerView(int placementId, MultiSizeBanner bannerView)**
Notifies that AATKit has new banner view ready for multisize placement.

**void AATKitManagedConsentNeedsUserInterface()**
Notifies about the need to show the consent dialog. After this event is called you should use ShowConsentDialogIfNeeded method.

**void AATKitManagedConsentCMPFailedToLoad(string error)**
Notifies that the used CMP failed to load.

**void AATKitManagedConsentCMPFinished()**
Notifies that the used CMP has finished updating consent.

**void AATKitManagedConsentCMPFailedToShow(string error)**
Notifies that the used CMP failed to show.

iOS binding

AATKitXamarin

**void Init(UIViewController viewController, AATKitDelegate @delegate) - DEPRECATED**
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void Init(UIViewController viewController, AATKitDelegate @delegate, int testId) - DEPRECATED**
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit. It also enables the test ads, and should only be used during development.

**void Init(UIViewController viewController, AATKitDelegate @delegate, bool rulesCaching, string initialRules) - DEPRECATED**
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void Init(UIViewController viewController, AATKitDelegate @delegate, AATConfiguration configuration) - DEPRECATED**
Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.

**void EditConsent()**
Presents the consent dialog. Mostly, should be used to change initial consent settings later, for example via app settings.

**void ReloadConsent()**
Calls the CMP to reload. Does not need to be used unless some error occurs.

**void ShowConsentDialogIfNeeded()**
Presents the consent dialog if it wasn't presented before. Mostly, should be used when app starts.

**void SetViewController(UIViewController viewController)**
Updates the view controller the ad network SDKs will use to display full screen content (either interstitials or content shown after the user clicks on an ad).

**void SetDebugEnabled(bool enabled)**
Enables debug mode with additional info on Application Output.

**void SetDebugShakeEnabled(bool enabled)**
Enables debug screen that will show after shaking the device. It is already enabled by default.

**string GetVersion()**
AATKit version.

**bool IsNetworkEnabled(AATKitAdNetwork network)**
Returns true if ad network is enabled, false otherwise.

**void SetNetworkEnabled(AATKitAdNetwork network, bool enabled)**
Allows to enable or disable selected ad networks. By default all networks are enabled.

**void CreatePlacement(string name, AATKitAdType type)**
Creates placement with given name and size.

**void StartPlacementAutoReload(NSObject placement)**
Enables automatic reloading of placement. Autoreloader will use reload time configured on addapptr.com account or fallback to default 30 seconds.

**void StopPlacementAutoReload(NSObject placement)**
Disables automatic reloading of placement.

**void ReloadPlacement(NSObject placement)**
Requests placement reload. Works only if automatic reloading is disabled. For banners it will not cause new banner to show more often than set banner refresh interval (default: 30s) - instead, it will set a timer to reload and show next ad when the refresh interval passes. To force ad reload and display before this delay, use the method ReloadPlacement(int, boolean) instead.

**void ReloadPlacement(NSObject placement, bool forced)**
Requests placement reload. Works only if automatic reloading is disabled. For native ads.

**bool HasAdForPlacement(NSObject placement)**
Returns true if there is an ad loaded for given placementId.

**UIView GetPlacementView(NSObject placement)**
Returns placement view. Works only for banner placements.

**string GetPlacementName(NSObject placement)**
Returns placement name for given placementId.

**NSObject GetPlacementId(string name)**
Returns identifier of placement with given name, or -1 if placement with given name does not exist.

**bool ShowPlacement(NSObject placement)**
Shows interstitial ad if ad is ready.

**void SetTargetingInfo(NSDictionary targetingInfo)**
Sets the targeting information for the application. This information will be used only if no placement-specific targeting is available.

**void SetTargetingInfo(NSDictionary targetingInfo, NSObject placement)**
Sets the targeting information for the given placement. Information provided for placement overrides targeting information for application set by the setTargetingInfo(Map).

**void AddAdNetworkForKeywordTargeting(AATKitAdNetwork adNetwork)**
Adds an ad network to the list of ad networks that receive targeting keywords (if any set). If no ad networks are added, any set keywords will be delivered to all ad networks supporting keyword targeting.

**void RemoveAdNetworkForKeywordTargeting(AATKitAdNetwork adNetwork)**
Removes an ad network from the list of ad networks that receive targeting keywords (if any set). If no ad networks are added to the list, any set keywords will be delivered to all ad networks supporting keyword targeting.

AATKitDelegate

**void AATKitHaveAd(NSObject placement)**
Notifies that placement has finished loading an ad successfully.

**void AATKitHaveAdOnMultiSizeBanner(NSObject placement, UIView placementView)**
Notifies that AATKit has new banner view ready for multisize placement.

**void AATKitNoAds(NSObject placement)**
Notifies that placement has failed to load an ad.

**void AATKitShowingEmpty(NSObject placement)**
Notifies that placement has loaded an Empty ad.

**void AATKitPauseForAd()**
Notifies that ad went fullscreen and that application should pause.

**void AATKitResumeAfterAd()**
Notifies that ad came back from fullscreen and that application should resume.

**void AATKitUserEarnedIncentive()**
Notifies that placement has earned incentive (by rewarded ads).

**void AATKitUserEarnedIncentiveOnPlacement(NSObject placement)**
Notifies that placement has earned incentive (by rewarded ads).

**void AATKitManagedConsentNeedsUserInterface()**
Notifies about the need to show the consent dialog. After this event is called you should use ShowConsentDialogIfNeeded method.

**void AATKitManagedConsentCMPFailedToLoad(string error)**
Notifies that the used CMP failed to load.

**void AATKitManagedConsentCMPFinished()**
Notifies that the used CMP has finished updating consent.

**void AATKitManagedConsentCMPFailedToShow(string error)**
Notifies that the used CMP failed to show.

More Info about AATKit integration

Android: https://bitbucket.org/addapptr/showcase-android/wiki/Home iOS: https://bitbucket.org/addapptr/aatkit-ios/wiki/Home

Updated