peanutlabs.*

Type Library
Revision Current Public Release (2017.3135)
Keywords ads, advertising, Peanut Labs
Platforms Android, iOS

Overview

The Peanut Labs plugin allows developers to monetize their mobile app with Peanut Labs surveys.

Important

Peanut Labs requires that you integrate their server-side callback and store the data from the callback in a database on your server. You can then retrieve the data from the app to verify if a user earned a reward.

Please see our server setup examples as a guideline for getting started.

Note

This plugin is only compatible with the following firmware versions:

  • iOS 8.0 and higher
  • Android 4.1 and higher

Registration

Before you can use this plugin, you must register with Peanut Labs.

Syntax

local peanutlabs = require( "plugin.peanutlabs" )

Functions

Events

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    plugins =
    {
        ["plugin.peanutlabs"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}

In addition, please add the appropriate OS version restrictions specified below to prevent your Peanutlabs-enabled apps from being installed on incompatible devices:

settings =
{
    android =
    {
        minSdkVersion = "16"
    },
}

Important

If building for iOS, you must bypass App Transport Security (ATS) by adding the following to the plist table of build.settings. While Corona Labs does not blindly encourage this approach for all developers and projects, bypassing ATS is required in certain cases. For more information on ATS, please see the Managing App Transport Security guide.

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

On devices running Android 6.0 and higher, this plugin requires the STORAGE permission group for caching of video ads. For details on requesting permissions at runtime, please see here.

Note

For Android, the following permissions/features are automatically added when using this plugin:

  • "android.permission.INTERNET"

Support