Skip to content
Jonathan edited this page Jun 21, 2013 · 2 revisions

#summary This document details how to install and use the Chartboost module.

Adding Chartboost to Monkey

  1. Download the module

  2. Install the module Make sure to copy the contents so you end of with a file at the following path: your_monkey_install_path/modules/skn3/chartboost/chartboost.monkey Or you can move the module to your projects folder like so: your_project_path/skn3/chartboost/chartboost.monkey Make sure all files are copied across, you should also have a folder called native which contains the iOS and and android code.

  3. If compiling for android you will need to add some code to the target, please see further on in the document for details. iOS does not require any modifications and will run out-of-the-box.

How the module works

The Chartboost module allows us to integrate adverts into our projects for cross promotion of other apps. For more information on Chartboost and its inner workings please visit the official website

The Monkey module has been designed so that the full functionality of the Chartboost SDK is available. This means we can setup a basic example or if required hook into the native events that Chartboost informs us of. The way to do this is by using the ChartboostDelegate Interface that the module provides. A good way of using the interface would be to make it so your Monkey app class implements the Chartboost interface. e.g.

Class MyApp Extends App Implements ChartboostDelegate

When we do this it means the MyApp object is preparing itself to be able to receive certain calls to some of its methods. These methods need to then be added to your MyApp class e.g.

Class MyApp Extends App Implements ChartboostDelegate
	Method shouldRequestInterstitial:Bool(location:String)
		Return true
	End

End

There are many of these events that Chartboost provides. When you implement ChartboostDelegate your MyApp class must have code for each event. The official SDK documentation states that some of the events are optional, but monkey does not provide a way for us to allow this so we just enforce that all are defined in your code. You can look at the example that comes with the module for a basic implementation.

A full documentation of all the Chartboost delegate/interface events can be found at the Official SDK: iOS Delegate Documentation Android Delegate Documentation

Once you have written your app code you must then start a chartboost session. Simply place some code into your apps constructor e.g.

Class MyApp Extends App Implements ChartboostDelegate
	Method New()
		//we must inform the chartboost module about MyApp wanting to receive chartboost delegate events
		ChartboostSetDelegate(Self)

		//start the chartboost session with our own details
		ChartboostStartSession(“YOUR_APP_ID”,”YOUR_APP_SIGNATURE_HERE”)
	End
End

This is all you need to do, Chartboost will now be fully operational.

The following Chartboost functions are available:

ChartboostSetDelegate(delegate:ChartboostDelegate)
ChartboostStartSession(appId:String,appSignature:string)
ChartboostCacheInterstitial(location:String=””)
ChartboostHasCachedInterstitial(location:String=””)
ChartboostCacheMoreApps()
ChartboostShowMoreApps()

Apart from ChartboostSetDelegate please read the Official SDK documentation to find out what each of these functions does. ChartboostSetDelegate() is explained above.

For information on your APP_ID, APP_SIGNATURE and how to use the Chartboost service please visit the official Chartboost help page Getting Started. To see a fully working example look in the module directory.

How to setup Android

Please see How To Setup Android for more information.