Kiip Android SDK
Read up on the various features and aspects of the Kiip Android SDK. For a step-by-step guide, please check out the Android Guide.
For advanced integrations you may prefer browsing the complete set of auto-generated Javadocs. If you have any questions about methods or classes mentioned and not outlined below please feel free to contact us.
Once you register an Android app on our application dashboard, we’ll automatically generate an App Key and App Secret–keep them handy when you start the initialization process. Generally, you’ll initialize the Kiip SDK within your Application’s
Application class method
The method to initialize the Kiip SDK takes the following parameters:
@param context (Application): The application context. Typically this.
@param appKey (String): Your application key, provided by Kiip.
@param appSecret (String): Your application secret, provided by Kiip.
me.kiip.sdk.Kiip is the only required import from Kiip when initializing.
endSession calls must be called on every
onStop method you implement in your activities.
Tells the Kiip SDK to start a session.
@param callback (Kiip.Callback): Callback that has
Tells the Kiip SDK to end a session.
@param callback (Kiip.Callback): Callback that has
When you save a moment with the SDK, it’s automatically registered with us on the dashboard. You will need to make sure the
Kiip.Callback() is up and running, to handle error.
Save a moment
@param momentId (String): The unique identifier of the moment. This will dynamically create a moment for tracking in the Kiip system. This is an arbitrary name chosen by you.
@param callback (Kiip.Callback): A callback that must be created to handle the
The Kiip SDK has built-in support for Android fragments. The recommended way to initialize the Kiip view manager
is by doing the following in your
You can then show a
Poptart by doing:
The Kiip object allows you to attach user information automatically without user intervention. For example, if you already have a user’s e-mail, you can pre-populate a reward unit when you reward your users.
Set the following properties on
Pre-populate the email field for the user.
@param email (String): Set the users email address
Sets a user’s user id for virtual currency rewards. Including it increases the potential revenue you can earn, as some rewards require it for delivery.
@param userId (String): Set the user ID
Set the users gender for better reward targeting.
@param gender (String): Set the users gender. E.g. “male” or “female”.
Set the users birthday for better reward targeting.
@param birthday (String): Set the users birthday.
Poptart is the name of the entire reward workflow Kiip manages for you. By calling
onPoptart when you save a moment, Kiip enables the following routine to run:
Kiip’s SDK can notify you of events that occur. Within the
BaseFragmentActivity class, you can set listeners for:
- video playback
- virtual currency
Called when the reward workflow starts.
Called when the entire reward workflow has ended.
Called when a full screen interstitial appears.
Called when a full screen interstitial disappears.
Called when a video reward will play.
Called when a video is finished (via user or completion).
Called when a video is fully viewed or completed.
To enable virtual currency you will need to create a currency listener and let Kiip know you can take virtual rewards. This listener will be called every time a virtual reward is served and the user redeems it.
Reward Redemption Callback URL
If you choose to validate a reward redemption, you may via a server callback. First you will have to set up a callback URL. This requires creating an endpoint on an accessible server.
Currently, the reward redemption callback URL may only be used with virtual currency reward redemptions.
Virtual Currency Reward Redemption Callback URL (optional)
The callback URL can be used to verify a virtual currency reward redemption. This callback does require a userId be set on the Kiip object.
The POST request will contain the following data:
- content (string): The unique identifier of the virtual currency (e.g. coins)
- quantity (int): The quantity of the virtual currency (e.g. 20)
- user_id (string): A unique field in which to verify the user. This could be any unique identifier, be it a login handle, email address or Advertising ID. This is required if using the virtual currency reward redemption callback.
- transaction_id (string): The unique reward transaction ID.
- signature (string): The signed signature of the payload. Used to verify valid posts. See below for more information.
Verify a virtual currency callback using this string containing the following:
Here’s a quick example of how you would verify the request in python:
Native Rewards offer more control over how Kiip rewards display. In most cases, Native Rewards are used to control display positioning. Containers designated for a Native Rewards must be 300px by 250px.
Utilize the Kiip dashboard to designate moments in which Native rewards should display:
To enable Native rewards in the ListView widget, initialize
KiipRewardAdapter and set it to
setAdapter of ListView widget with the position to show the Kiip Reward Unit.
To enable Native rewards in any view, add
<me.kiip.sdk.KiipNativeRewardView/> to the layout.xml. The size of the NativeRewardView is fixed to 300x250px.
To enable Native rewards in the RecyclerView widget, create/add linearlayout as recyclerview row like recyclerview_rewardview_row.xml and define the
<me.kiip.sdk.KiipNativeRewardView/> as row component.
Follow this 6 step process in your Activity or Fragment to successfully integrate KiipNativeRewardView in RecyclerView component for e.g.,
The Kiip SDK allows you to attach your own assets when you show a notification view. This promotes a higher level of immersion for your app’s UX. Step one is to ensure you are saving moments correctly. Once that’s taken care of, navigate to your saveMoment callback.
You’ll want to start by listening in on the poptart.onShow method. Once that’s taken care of, you can begin to construct your own notification view, and attach it to the poptart:
Once you’ve created your new poptart with your custom notification, every time you call saveMoment with the completionHandler, you can do onPoptart(poptart).
Check out the notification below to get an idea of what a custom notification can look like (You earned a reward! section):
Note: There is more than one right way of implementing custom notifications.