AIR

From POKKT DOCUMENTATION
Jump to: navigation, search

POKKT SDK v5.0 Integration Guide for AIR (Android)

Last Update: October 20th, 2016

Download Latest Version Here with PDF Documentation v5.0.


1. Overview

Thank you for choosing Pokkt SDK Plugin v5.0for AIR. Pokkt SDK supports Reward Ad, Non-Reward Ad, Banner Ad and Offerwal campaigns feature. This document contains all the information which is needed to setup the SDK with project. Please follow these steps as per your integration requirement (Reward/Non- Reward/Banner/Offerwal). The current plugin supports mediation for various third party ad-networks. These are:

  • AdColony
  • AppLovon
  • Chartboost
  • Fyber
  • InMobi
  • SuperSonic
  • UnityAds
  • TapJoy
  • Vungle
  • AdMob
  • Facebook

A separate set of documents is provided for each of these, explaining the implementation process.

There is a sample app provided with the SDK. We will be referencing this app during the course of explanation in this document. It is suggested that you should check that app to understand the following process in detail.


2. Configuration Steps

All we need is the file provided PluginExtension.zip file which contains three files
PokktExtensionAndroid.ane, PokktGooglePlayService_ANE.ane and PokktMediation.ane.

Add .ane file in your project properties and also please read hereto understand how AIR ane works.

Android Manifest xml update:

  1. Add following permissions in your App xml under android manifest, If not already there.

    <!-- These permissions are mandatory to run Pokkt SDK -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <!-- These permissions are strongly recommended and will result in higher performance -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- This permission is optional but will improve SDK feature-->
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
  2. Add the following activity in your App xml under android manifest for OfferWall Integration

    <activity
       android:name=“com.app.pokktsdk.ShowOfferwallActivity"
       android:configChanges=“keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize"
       android:label=“@string/app_name"
       android:windowSoftInputMode="adjustPan" >
    </activity>
  3. Add the following activity in your App xml under android manifest for Video Integration

    <activity
       android:name=“com.app.pokktsdk.PlayVideoCampaignActivity”
       android:configChanges=“keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize”
       android:label=“@string/app_name”
       android:screenOrientation=“landscape”
       android:windowSoftInputMode="stateAlwaysHidden|adjustUnspecified" >
    </activity>
  4. Add the following VPAID ads activity in App xml under android manifest.

    <activity
       android:name=“com.app.pokktsdk.VPAIDActivity”
       android:configChanges=“keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize”
       android:label=“@string/app_name”
       android:windowSoftInputMode="stateAlwaysHidden|adjustUnspecified" />
  5. Add the following interstitial ads activity in App xml under android manifest for Pokkt Interstitial Integration.

    <activity
       android:name=“com.app.pokktsdk. PokktInterstitialActivity”
       android:configChanges=“keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize”
       android:label=“@string/app_name”
       android:windowSoftInputMode="stateAlwaysHidden|adjustUnspecified" />
  6. Add Following Broadcast receiver for OfferWall Integration in App xml under android manifest

    <receiver android:name="com.app.pokktsdk.AppInstallBroadcastReceiver">
       <intent-filter android:priority="1000">
           <action android:name="android.intent.action.PACKAGE_INSTALL" />
           <action android:name="android.intent.action.PACKAGE_ADDED" />
           <data android:scheme="package" />
       </intent-filter>
    </receiver>
  7. Add Following meta tag for google play services (Goole play services is required and should be part of your project, if not, please add the GooglePlayService component in project).

    <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
  8. Add a meta data tag for offerwall campaign. you will have to implement the IOfferwallDelegateinterface in your project to listen for all offerwall related events. (refer to pokkt sample for example).

    <meta-data android:name=“offerwallDelegate"
    android:value=“" />
  9. Add following Service and receiver in manifest for google analytics (Optional).

    <receiver android:name=“com.google.android.gms.analytics.AnalyticsReceiver" android:enabled=“true">
       <intent-filter>
          <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
       </intent-filter>
    </receiver>
    
    <service android:name=“com.google.android.gms.analytics.AnalyticsService"
       android:enabled=“true"
       android:exported=“false"/>
  10. Add following Service and receiver in manifest for google analytics (Optional).

    <service
        android:name=“com.app.pokktsdk.notification.NotificationService"
        android:label=“PokktNotificationService”
        android:exported="false"/>

Note:Please do not copy the code points from this PDF file as it may introduce unwanted characters and space in your code. Instead please refer to sample app source code provided with the sample app.


3. Implementation Steps

Common

  1. For all invocation of Pokkt SDK developer will make use of methods available in PokktManagerclass. This class only have static methods.
  2. In PokktConfigyou can set ApplicationId, SecurityKey, IntegrationType. which are must for all type of integrations. Please check the sample app.
  3. Before calling any other methods from the PokktManager, please make sure that you have called the InitPokktwith passing PokktConfigobject.
  4. IIf you are doing server to server integration with POKKT you can also set ThirdPartyUserIdin PokktConfig.
  5. Apart from above mentioned parameters you can assign additional ones based on your integration type (please refer to OfferWall and Reward sections below).
  6. While in development, please call PokktManager.setDebug(true);to see pokkt debug logs and toast messages. please make sure to change this to PokktManager.setDebug(false); for production build.
  7. Android MinSDKVersion should be >= 14.
  8. To use google analytics, please set AnalyticsType and Analytics ID in PokktConfig.

    pokktConfig.selectedAnalyticsType = AnalyticsType.GOOGLE_ANALYTICS;
    pokktConfig.googleAnalyticsID = “Id”;
  9. To use flurry analytics please set AnalyticsType and Flurry Application Key in PokktConfig.

    pokktConfig.selectedAnalyticsType = AnalyticsType.FLURRY;
    pokktConfig.flurryApplicationKey = “key”;
  10. To use mix panel analytics please set AnalyticsType and Mix PanelProject Token in PokktConfig

    pokktConfig.selectedAnalyticsType = AnalyticsType.FLURRY;
    pokktConfig.mixPanelProjectToken = “token”;
  11. To use mix panel analytics please set AnalyticsType and Fabric Token in PokktConfig

    pokktConfig.selectedAnalyticsType = AnalyticsType.FABRIC
  12. Please call trackIAP(InAppPurchaseDetail) to send any in-app purchase information to Pokkt. Like below you can do this.

    // create object of InAppPurchaseDetails and set properties for purchaseDetail s and pass object
    PokktManager.trackIAP (InAppPurchaseDetails);

Session

  1. We have option to start session for tracking: startSession and endSession methods in PokktManager.
  2. You should call startSessionat the start of his application if you want to use this but this is the optional and call it after setting application id and security key.
  3. You should call endSessionat the end of his application.

OfferWall

  1. In PokktConfigfor OfferWall you can set two additional parameters which are OfferWallAssetValueand closeOnSuccessFlag. OfferWallAssetValue is only required if you only want to show campaign of certain value on offerwall. closeOnSuccessFlagis required if you wish to close the OfferWall after user has completed one offer. It’s default value is false.
  2. Before calling another method for offerWall in PokktManager, please make sure that you have already called initPokkt first.
  3. You need to add event listener as below or also please check the OfferwallScreen class in sample app.

    PokktManager.dispatcher.addEventListener(PokktEvent.POKKT_INITIALISED_EVENT, onPokktInitialised);
    PokktManager.dispatcher.addEventListener(PokktEvent.COIN_RESPONSE_EVENTS, onCoinResponseSuccess);
    PokktManager.dispatcher.addEventListener(PokktEvent.COIN_RESPONSE_WITH_TRANS_ID_EVENTS, onCoinResponseWithTransID);
    PokktManager.dispatcher.addEventListener(PokktEvent.COIN_RESPONSE_FAILED_EVENTS, onCoinResponseFailed);
    PokktManager.dispatcher.addEventListener(PokktEvent.OFFERWALL_CAMPAIGN_AVAILABLITY_EVENT, onOfferwallAvailability);
    PokktManager.dispatcher.addEventListener(PokktEvent.OFFERWALL_CLOSE_EVENT, onOfferwallClosed);
  4. To show OfferWall you can call PokktManager.getCoins(pokktConfig).
  5. Please register native application to handle for resume and call
    PokktManager.getPendingCoins(pokktConfig); this method so that you get a callback to award points to the user after user has come back to your game after finishing with OfferWall.
  6. You can call PokktManager.checkOfferWallCampaign(pokktConfig); to check whether the campaigns are available before showing OfferWall button to user. You will get a callback for this call.

AdConfig (used for reward / non-reward ad)

  1. In AdConfigyou should set screenNameand isRewarded. This screen name will be created on pokkt dashboard.

    Screen Name:For screen name, you will have to create in Pokkt dashboard. Please check below screen. This will help you to understand how to create new screen name in Pokkt dashboard.

    bordered

  2. In AdConfig, developer can also set shouldAllowSkip, defaultSkipTime, skipConfirmMessage, backButtonDisabled, shouldAllowMute, shouldSkipConfirm, skipConfirmYesLabel, skipConfirmNoLabel, skipTimerMessageand incentiveMessage. These values can be used to configure the behaviour of ad.
  3. If you want to enable/disable the skip button on video screen please set shouldAllowSkipas true/false.The default value for shouldAllowSkip is true.
  4. If you have enabled skipped button by setting shouldAllowSkipas true then you can control after how many seconds the skip button will be visible in video by setting defaultSkipTimeto appropriate value.Since most videos will be 30 sec or less please set defaultSkipTimeas 10 or less.You can also give your own skip message by setting skipConfirmMessage on AdConfig
  5. The screenNamehas default value as default and can be used by you to give different screen name for different places in your app where you are showing ads. You will control ad targeting based on these screen names which should match exactly with screen names defined in dashboard. ScreenName can not contain white spaces and only special characters allowed are hyphen and underscore.
  6. You can choose to show ad with or without incentive to user by setting isRewardedas true or false. Ad gratification will only happen for incentivised playback.
  7. You can disable the back button while video is playing by setting backButtonDisabledon AdConfig.
  8. You can configure the ad skip dialog yes/no labels by setting skipConfirmYesLabel and skipConfirmNoLabel.
  9. You can configure the ad incentive message by setting incentiveMessage.
  10. You can configure the ad skip timer message by setting skipTimerMessage. The message must contain a ## placeholder to show skip time value, which will keep changing as per the time.

Rewarded Ad/Non-Rewarded Ad

  1. You need to set true/false for rewarded or non-rewarded ad like below:

    adConfig.isRewarded = true/false;
  2. You will have to call cache ad to start caching ads on device.

    PokktManager.cacheAd(adConfig)
  3. You will need to register event for getting callback for Ad related like below and also please check given sample app PlayVideoScreen class.

    PokktManager.dispatcher.addEventListener(PokktEvent.POKKT_INITIALISED_EVENT, onPokktInitialised);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_AVAILABILITY_STATUS_EVENT, onAdAvailability);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_CACHING_COMPLETED_EVENTS, onAdCachingCompleted);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_CACHING_FAILED_EVENTS, onAdCachingFailed);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_CLOSED_EVENTS, onAdClosed);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_COMPLETED_EVENTS, onAdCompleted);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_SKIPPED_EVENTS, onAdSkipped);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_DISPLAYED_EVENTS, onAdDisplayed);
    PokktManager.dispatcher.addEventListener(PokktEvent.AD_GRATIFIED_EVENTS, onAdGratified);
  4. You can call checkAdAvailability to check if the campaign are available for a particular adConfig before you try to show ad.

    PokktManager.checkAdAvailability(adConfig)
  5. You can call showAd method to show ad.

    PokktManager.showAd(adConfig);
  6. Please reward user only when AdGratified event gets triggered.

Pokkt SDK allows to show banner ad on your screen. You can set any custom size or any position for banner. There are few fixed position already given in BannerPosition class. But you can customise that also.

  1. Load Banner:Use loadBanner to show banner ad like below:

    PokktManager.loadBanner(ScreenName, BannerPosition.TOP_CENTER);
  2. Remove Banner:Use removeBanner to remove banner ad from screen like below:

    PokktManager.removeBanner(ScreenName);
  3. Auto Refresh Banner:Use setBannerAutoRefresh method to disable or enable auto refresh. Default it is true and it will refresh automatically based on given time on Pokkt dashboard for particular screen name.

    PokktManager.setBannerAutoRefresh(false/true);
  4. Banner Position::Use BannerPosition class properties for banner position.
  5. Custom Banner:There are also option is given to custom banner size and set custom position by using below method:

    PokktManager.loadBannerWithRect(ScreenName, width, height, x, y);
  6. Banner Event:Register event to get banner related callback like below:

    //Register event
    PokktManager.dispatcher.addEventListener(PokktEvent.BANNER_LOADED, onBannerLoaded);
    PokktManager.dispatcher.addEventListener(PokktEvent.BANNER_LOAD_FAILED, onBannerLoadFailed);
    
    // Handler method
    protected function onBannerLoaded(event:PokktEvent):void {
        //event.screenName: same scree name for what banner ad request was done
    }
    protected function onBannerLoadFailed(event:PokktEvent):void {
        //event.screenName: same scree name for what banner ad request was done
        //event.message: Reason why banner load failed
    }
  7. Screen Name:For screen name, you will have to create in Pokkt dashboard. Please check below screen. This will help you to understand how to create new screen name in Pokkt dashboard. bordered

Mediation Info

  1. Pokkt SDK now supports 11 ad networks which you can integrate in your application for better monetisation.
  2. To integrate these networks through Pokkt, please visit the mediation menu on downloads page and download AIR mediation zipand documentation zipfiles.
  3. Please follow the mediation integration documents shipped for each network.
  4. You will need to create account on these networks and add the network details in your Pokkt dashboard after login into your account on pokkt website.
  5. You will also need to do the mapping of Pokkt screens with the corresponding ad networks’ placement id/zone id/ad unit etc in the dashboard.

Export Logs

  1. Developer should call PokktManager.exportLog()to export the Pokkt SDK logs to folder of your choice.
  2. This API shows a folder chooser dialog where user can choose a particular folder.
  3. User can also create a new folder where user wants to export the logs.

Optional Parameters

PokktConfigalso has provision for developers to provide extra user data available with them to pokkt. We currently support following data points: name, age, sex, mobileNo, emailAddress, location, birthday, maritalStatus, facebookId, twitterHandle, setEducation, setNationality, setEmploymentand setMaturityRating.


In-App Notifications

Developer can add In-App notifications in their dashboard.

Inapp1.jpg


Repeat schedule can be daily, weekly monthly. Daily Repeat can have options like frequency of repeat and time in hours of notification.

Inapp2.jpg


Weekly repeat can have options like frequency of repeat in weeks, days of repeat and time in hours of notification.

Inapp3.jpg


Monthly repeat can have options like frequency of repeat in months dates of repeat and time in hours for notification.

Inapp4.jpg


For don't repeat case, there are options like dates and time in hour for notification.

The notifications are listed and can be edited. Notifications can also be deactivated/activated

Inapp5.jpg



4. Important Points

PPlease do not copy the code points from this pdf as it may introduce unwanted characters and space in your code. Instead please refer to sample app source code in pokkt bundle. Please also refer to sample app source code for better understanding of implementation.