Corona Integration Guide

Introduction

This guide will walk you through integration of Kiip into a Corona project.

Download

Get the latest Corona package from Corona Marketplace.

Project Settings

Include Kiip Corona Plugin as follows in build.settings.

settings =
{
  plugins =
  {
      ["plugin.kiip"] =
      {
          publisherId = "me.kiip",
          supportedPlatforms = { iphone=true, android=true }
      },
  },
}

iOS

If building for iOS, you must bypass App Transport Security (ATS) by adding the following to the plist table of build.settings.

settings =
{
  iphone =
  {
    plist =
    {
    NSAppTransportSecurity = { NSAllowsArbitraryLoads=true },
    },
  },
}

Note: in iOS the following frameworks are added

'CoreTelephony', 'QuartzCore', 'SystemConfiguration', 'AdSupport', 'Passkit', 'MediaPlayer'

Android

In Android the following permissions are added

"android.permission.INTERNET",
"android.permission.ACCESS_NETWORK_STATE",
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_FINE_LOCATION",

Functions

Initializing Kiip in your main.lua

local kiip = require( "plugin.kiip" )
kiip.init(YOUR_KEY, YOUR_SECRET)

Properties

kiip.setProperties({
testMode = true, --optional
email = "paidapp@example.com", --optional
gender = "male", --optional, either "male" or "female"
birthday = 1478059402000, -- optional, this is epoch time in milliseconds
capabilities = {"array 1", "array 2"}, --optional, array of string
shouldAutoRotate = false -- optional, ios only
})

Methods

kiip.saveMoment({
saveMomentId = "test", -- required
value=20, -- optional
onFailed = function(errMsg) -- optional, errMsg is String that tells the error message
end,
onFinished = function(hasPoptart) --optional, hasPoptart is a boolean tells if there is a poptart to display
if (hasPoptart) then
--if you have a poptart, you can call kiip.showPoptart({}) to display the poptart right away, or you can hold the poptart to display in later time
end
end
})

Display a poptart, note: prior to this call, you must call saveMoment to successfuly obtain a poptart.

kiip.showPoptart({
  onShowPoptart = function()--optional, callbacks when poptart displayed
    print("KiipPlugin, lua onShowPoptart")
  end,
  onDismissPoptart = function()--optional, callbacks when poptart dismissed
    print("KiipPlugin, lua onDismissPoptart")
  end,
  onShowNotification = function()--optional, callbacks when notification displayed
    print("KiipPlugin, lua onShowNotification")
  end,
  onDismissNotification = function()--optional, callbacks when notification dismissed
    print("KiipPlugin, lua onDismissNotification")
  end,
  onClickNotification = function()--optional, callbacks when notification clicked
    print("KiipPlugin, lua onClickNotification")
  end,
  onShowModal = function()--optional, callbacks when modal displayed
    print("KiipPlugin, lua onShowModal")
  end,
  onDismissModal = function()--optional, callbacks when modal dismissed
    print("KiipPlugin, lua onDismissModal")
  end,
  onVideoShow = function()--optional, callbacks when video played
    print("KiipPlugin, lua onVideoShow")
  end,
  onVideoDismiss = function()--optional, callbacks when video dismissed
    print("KiipPlugin, lua onVideoDismiss")
  end
})

Notify Kiip when the app is on foreground by calling startSession

kiip.startSession({
  onSessionStarted = function() --optional
    print("KiipPlugin, lua onSessionStarted")
  end,
  onSessionStartFailed = function(errMsg) --optional
    print("KiipPlugin, lua onSessionStartFailed")
  end
})

Notify Kiip when the app is in background by calling endSession

kiip.endSession({
  onSessionEnded = function() -- optional
    print("KiipPlugin, lua onSessionEnded")
  end,
  onSessionEndFailed = function(errMsg) -- optional
    print("KiipPlugin, lua onSessionEndFailed")
  end
})

Sample Code:

click here to see our sample project

Rewarded Video

Access more inventory, increase engagement and drive more revenue with Rewarded Video. To utilize Rewarded Video, designate and individual moments placement in the Kiip dashboard.

Kiip Rewarded Video Moment

Need Help?

We’re happy to answer any questions about integrating Kiip. Check out our FAQ or email us.