Titanium
Contents
1 POKKT SDK v5.0 Integration Guide for Appcelerator (Android)
1.1 1. Overview:
1.2 2. Configuration Steps
1.2.1 Android-Manifest Changes
1.3 3. Implementation Steps
1.3.1 Common
1.3.2 Session
1.3.3 Offerwall
1.3.4 Rewarded/Non-Rewarded Ads
1.3.5 Export Logs
1.3.6 Optional Parameters
POKKT SDK v5.0 Integration Guide for Appcelerator (Android)
Last Update: 18th November, 2016
Download Latest Version Here with PDF Documentation v5.0.
1. Overview:
Thank you for choosing Pokkt SDK Plugin v5.0 for Appcelerator. Pokkt SDK supports Offerwall as well as Video/Interstitial-Ad campaigns feature. This document contains all the information that is needed by you to setup the SDK with your project. Please follow these steps as per your integration requirement (Ad/Interstitial/Both). The current plugin supports mediation for various third party ad-networks. These are:
AdColony
AppLovon
Chartboost
Fyber
InMobi
SuperSonic
UnityAds
TapJoy
Vungle
AdMob
Facebook
MoPub
A separate set of documents is provided for each of these, explaining the implementation process.
Kindly note that these instructions are for Appcelerator with Titanium SDK Version 5.x and above, older versions of are not supported.
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.
Note:Please do not copy the code points from this Doc/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.
2. Configuration Steps
There are three files that are provided and will be needed by you to use the plugin:
com.pokkt.titaniumandroid-android-5.0.zip
pokkt_native_extension.js
In order to add this to you project, go to Help -> Install Mobile Module,browse to com.pokkt.titaniumandroid-android-5.0.zipand press “Ok”.This should install the plugin in your project. Next, copy pokkt_native_extension.jsinside your Resource folder. Now the plugin should be ready for you to use with your project.
Minimum android SDK version is 14.
Android-Manifest Changes
(You can edit these inside timodule.xmlafter you install the Pokkt module.)
Permissions:
Activities:
Needed for Offerwall:
Needed for ads:
Broadcast Receivers:
Needed for Offerwall:
Optional for Google Analytics:
Meta-Data tags:
Needed for Offerwall:
Services:
Optional for In-App Notifications:
3. Implementation Steps
Common
For all invocation of Pokkt SDK developer will make use of methods available in pokktNativeExtension.jsfile using PokktExtensionobject.
Create a PokktConfigobject using creatPokktConfig()method, then provide applicationIdand securityKey, these are must for initializing Pokkt.
Once you have your pokktConfig ready, invoke initPokktmethod before you invoke any other methods from the PokktExtension. This does not apply to session related methods namely startSession and endSessionand few utility methods.
In order to know whether Pokkt is initialized or not, listen to ‘PokktInitialised’ event, if the provided Boolean parameter is true only then move ahead with other operations.
If you are doing server to server integration with Pokkt you can also set thirdPartyUserIdin pokktConfigobject.
Apart from above mentioned parameters you can assign additional ones based on your integration type. Refer to Offerwall and Video sections below.
While in development please call PokktExtension.setDebug(true) to see Pokkt debug logs and toast messages. Make sure to change this to falsefor production build.
Call PokktExtension.notifyAppInstall()to log your application installation information with Pokkt.
Call PokktExtension.trackIAP(details)to log any in-app purchase details with Pokkt. Accepted values are (all caps): “NONE”, “GOOGLE”, “IOS”, “AMAZON”.
To use google analytics, please set selectedAnalyticsType to “GOOGLE_ANALYTICS” and googleAnalyticsIDin pokktConfig.
To use flurry analytics please set selectedAnalyticsTypeto “FLURRY” and flurryApplicationKeyin pokktConfig.
To use mix panel analytics please set selectedAnalyticsTypeto “MIXPANEL” and mixPanelProjectTokenin pokktConfig.
To use mix panel analytics please set selectedAnalyticsTypeto “FABRIC”.
Session
Invoke PokktExtension.startSession()at the start of his application and once only.
You should callPokktExtension.endSession()at the end of his application and once only.
Offerwall
In pokketConfigfor Offerwall you can set two additional parameters which are setOfferWallAssetValueand setCloseOnSuccessFlag.Setting of setOfferWallAssetValueis only required if you only want to show campaign of certain value on the Offerwall. setCloseOnSuccessFlagis required if you wish to auto-close the Offerwall after user has completed one offer. It’s default value is false.
Make sure to call initPokktbefore calling another method for Offerwall in PokktExtension.
To show Offerwall you can call PokktExtension.getCoins(pokktConfig).
In the screen or activity where you have button to show Offerwall, in that activity onResumeyou should call PokktExtension.getPendingCoins(pokktConfig) so that you get a callback to award points to the user after he has come back to your game after finishing with Offerwall. You will get a callback for this call in your IOfferwallDelegate implementation class in method EarnedCoinsor CoinResponseFailed.
You can call PokktExtension.checkCampaignAvailable(pokktConfig)to check whether the campaigns are available before showing Offerwall button to user.
Following are offerwall-related events, you can refer to the provided sample-code to understand the ideal implementation on how to consume these:
CoinResponse
CoinResponseWithTransId
CoinResponseFailed
CampaignAvailability
OfferwallClosed
Rewarded/Non-Rewarded Ads
You will have to configure an adConfigobject to request for any ad to be displayed. Get one using createAdConfig()method. It also provides options for customizing your ad-screen. It is recommended to have different adConfigobjects for each screens. Followings are the values that you can set with adConfig:
screenName (Required): This controls the placement of ads and can be created on Pokkt Dashboard.
adFormat (Required): Requested ad format. SDK supports Video, Interstitial and banner adFormats. Default is Video ad format.
isRewarded (Required): Requested ad type. Ad gratification will happen only for rewarded ads.
backButtonDisabled:Disable ‘back’ button press while on ad-screen.
defaultSkipTime:If ad-skipping is allowed, this provides the seconds it will wait before the skip button appears.
shouldAllowSkip:Whether skipping-ad is allowed or not. If set to ‘false’, user will be forced to watch the ad till it finishes.
shouldAllowMute:Whether to allow sound-mute while on ad-screen, it controls the ‘mute’ button. Cannot contains whitespaces and only special characters allowed are hyphens (-) and underscores (_).
shouldConfirmSkip:Controls whether to show the skip-confirmation dialog box. If set to ‘false’, the ad will be silently closed without prompting for confirmation
skipConfirmMessage: The message that will appear on skip-confirmation dialog box.
skipConfirmYesLabel:‘Yes’ Label of skip-confirmation dialog box.
skipConfirmNoLabel: ‘No’ Label of skip-confirmation dialog box.
skipTimerMessage: The message on countdown-timer before the skip button appears. The message must contain a ‘##’-placeholder to show timer value.
incentiveMessage:If set, the message will be displayed while prompting user to watch the ad for certain time before it can be rewarded.
Invoke PokktExtension.cacheAd(adConfig)to cache the ad on device. Cached-ads provide better user experience than streaming-ads
You can call PokktExtension.checkAdAvailability(adConfig) to check if the adcampaigns are available or not. The result will be notified via 'AdAvailability'.
Invoke PokktExtension.showAd(adConfig) to show ad.
Following are ad-related events, you can refer to the provided sample-code to understand the ideal implementation on how to consume these:
AdCachingCompleted
AdCachingFailed
AdClosed
AdCompleted
AdDisplayed
AdSkipped
AdGratified
AdAvailability
Reward user ONLY from the 'AdGratified' event.
Export Logs
Developer should call PokktExtension.exportLog() to export the Pokkt SDK logs to folder of your choice.
This API shows a folder chooser dialog where user can choose a particular folder.
User can also create a new folder where user wants to export the logs.
Optional Parameters
PokktConfig also 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, Education, Nationality, EmploymentandMaturityRating.
Last updated