Compatibility

iOS: The Megacool SDK supports iOS 7+, but GIF capturing is only supported on iOS 8+.
Android: The Megacool SDK supports Android API level 16 (4.1.x, Jelly Bean) and up. Recording is only from API level 18 and up.

Latest SDK version

5.0.5


Overview

The Megacool SDK provides two ways to boost user growth:

  • Incentivize users to refer their friends
  • Make it easy to share GIF moments

This quickstart guide will help you set up the basic functionality of the Megacool SDK:


Step 1: Set up your app on the dashboard

Set up your app on the dashboard to receive the required keys for the SDK. After you're done, refresh this page to see your keys in this guide.


Step 2: Install the Megacool SDK

Download the Unity package and import it to your project through Assets -> Import Package -> Custom package.

Go to File --> Build Settings --> Player Settings --> Other Settings --> Identification and fill out:

  • iOS Bundle Identifier: YOUR_BUNDLE_ID

  • iOS Developer Team ID: YOUR_APPLE_TEAM_ID

You should now have a new menu bar item under Window called Megacool. Open it and press Configuration to fill out:

  • Android Key: YOUR_ANDROID_KEY

  • iOS Key: YOUR_IOS_KEY

To enable deep linking to your app, also fill out the following:

  • iOS scheme: YOUR_URL_SCHEME

  • Android scheme: YOUR_URL_SCHEME

Press Save changes when you're done.

Initialize the SDK

Start Megacool as early as possible when the app opens:

void Start() {
// This needs to be called early to be able to track installs
Megacool.Instance.Start();
}

Step 3: Set up referrals

Make it easy for players to share your game to their friends. Incentivize players by rewarding them for each share they send that leads to a new friend installing the game.

Add the following on app start to listen for shares that have resulted in installs:

void Start() {
// Receiver's callback for when a share has been opened
Megacool.Instance.ReceivedShareOpened += (MegacoolReceivedShareOpenedEvent megacoolEvent) => {
Debug.Log("Got event: " + megacoolEvent);
if (megacoolEvent.IsFirstSession) {
// This device has received a share and installed the
// app for the first time
Debug.Log("Installed from a referral from " + megacoolEvent.SenderUserId);
}
};
Megacool.Instance.SentShareOpened += (MegacoolSentShareOpenedEvent megacoolEvent) => {
Debug.Log("Got event: " + megacoolEvent);
if (megacoolEvent.IsFirstSession) {
// A share sent from this device has been opened, and
// the receiver installed the app for the first time
Debug.Log(megacoolEvent.ReceiverUserId + " installed the app from our referral");
}
};
// Initialize the Megacool SDK. The callbacks must be
// registered before this.
Megacool.Instance.Start();
}

Note: The callbacks are registered before Megacool.Instance.Start() to ensure all events are handled.

Add a referral button

Add a referral button that lets players refer their friends by sharing a link to the game. Call the following method when pressed:

Megacool.Instance.Share();

This opens a share modal with a link to your game that lets players refer friends through any channel available on their device.

You can read more about referrals here and how to test them here.


Step 4: Add media

Add a recording to the share

To increase the share-to-install conversion rate, make the share more appealing by adding a recording of the game play. When the game session begins, start a new recording:

Megacool.Instance.StartRecording();

The recording will keep a buffer of the last 5 seconds by default. Old frames get overwritten by new frames.

End the recording when the game session is over by calling:

Megacool.Instance.StopRecording();

The next time you call Megacool.Instance.Share, the latest recording will be included in the share together with the referral link.

Read more about how to customize recordings here.

Note: Make sure your game has a main camera, as we'll fall back to recording from that on devices that don't support direct capturing from the screen. Alternatively you can select a custom camera to use by following these steps.

Add fallback media

Fallback media is used in cases when there’s no recording or if the recording has failed. The fallback media can be JPEG, PNG, GIF or even MP4. For historical reasons, the SDK refers to it as FallbackImage.

Create a folder called StreamingAssets if you don't have it already and add the fallback media to the folder. Expand the default share function call by the following:

Megacool.Instance.Share(new MegacoolShareConfig {
FallbackImage = "promoVideo.mp4"
});

When choosing your media file please keep in mind that there's a size limit for some social media platforms, so try to stay below 3MB.

Note: Fallbacks also need to be set on the server-side for the best experience, but we don't have an automatic way to set these yet. Contact us if you want this and we'll help you get it sorted.

Do a test run!

Build your project to a device and run it!

Note: In case you have another SDK that also subclasses the UnityAppController, you have to merge MegacoolAppController to make link handling work for both. Check out an example merge with Tune SDK (TuneAppController.m): MergeUnityAppController.m. Remember to delete the original files after merging into a new file.


Notice

We strongly believe in not crashing your apps. But, since networking and computers are inherently unreliable, stuff sometimes fails. To prevent your users from noticing these failures, you should always be prepared for our API calls to return nil or other signals of failure, and have a plan if that happens. This can happen if your app runs out of memory, disk is full, or some other bug is present which prevents us from delivering the expected value from our API calls. We believe in the philosophy of progressive enhancement, and this is your best way for interacting with our API as well. In practice, always assume that our tools fail, but rejoice when they are working as promised.