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 18 (4.3.x, Jelly Bean) and up.

Latest SDK version

3.3.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
Step 2: Install the Megacool SDK
Step 3: Set up referrals
Step 4: Add media

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 called Megacool. Open it and press Configuration to fill out:

  • iOS Key: YOUR_IOS_KEY

  • Android Key: YOUR_ANDROID_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.


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.OnReceivedShareOpened += (MegacoolEvent megacoolEvent) => {
// Check if this is a new install
if (megacoolEvent.FirstSession) {
// Receiver installed the app for the first time
Debug.Log("This device installed the app.");
}
};
// Sender's callback for when a share has been opened
Megacool.OnSentShareOpened += (MegacoolEvent megacoolEvent) => {
// Check if this is a new install
if (megacoolEvent.FirstSession) {
// Receiver installed the app for the first time
Debug.Log("Your friend installed the app. Here's your reward!");
}
};
// Initialize the Megacool SDK
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.

Read more about referrals and how to test it 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 promo 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 promo 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: Certain platforms do not support uploading media files, so it has to be set manually from the server side. Please contact us if you wish to add support for a missing platform.

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 strongly 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.

Note: In the case of severe performance regressions, bugs on certain platforms, we can disable some of our features remotely. This would have the same effect as a feature not working. Thus it's easy to test the error conditions locally.