Unity SDK
RapidoReach Unity Integration Guide
Get Your API Key
Sign-up for a new developer account and create a new Unity app here and copy your API Key.
Download the Plugin
Download the latest version of the RapidoReach Unity Plugin here.
Import the Unity Package
From Unity go to Assets menu → Import package → Custom package → choose the unzipped unity package.
Android
Ensure the RapidoReach-1.0.0.aar and other files were successfully imported with the RapidoReach.cs file in your "Assets/Plugins" folder.
In your player settings ensure the minimum API is set to 15 (Jelly Bean) or higher.
Initialize RapidoReach
We recommend initializing RapidoReach as soon as possible so we can begin preparing surveys for the user. In the Initialize method you'll set your API key and the user's ID that will be passed back into your server side callback when the user has earned currency for completing a survey.
#if UNITY_ANDROID || UNITY_IOS
// Your GameObject that triggers the Reward Center
void Start()
{
ConfigureRapidoReach();
}
public void ConfigureRapidoReach()
{
#if UNITY_IOS || UNITY_ANDROID
RapidoReach.Initialize("d5ece53df8ac97409298325fec81f3f7", "ANDROID_TEST_ID");
RapidoReach.SetListener(gameObject.name);
// optional
RapidoReach.SetNavigationBarText("RapidoReach Unity N");
RapidoReach.SetNavigationBarColor("#211548");
RapidoReach.SetNavigationBarTextColor("#FFFFFF");
#endif
}
// call this function to show reward center on button click etc
public void showRewardCenter(){
Debug.Log("UNITY: Calling show reward center");
#if UNITY_IOS || UNITY_ANDROID
RapidoReach.ShowRewardCenter();
#endif
}
void OnReward(string quantity)
{
FindObjectOfType<ReceivedRewards>().GetComponent<Text>().text = quantity;
Debug.Log("RapidoReach OnReward: " + quantity);
}
void OnRewardCenterOpened()
{
FindObjectOfType<ReceivedRewards>().GetComponent<Text>().text = "Loading ...";
Debug.Log("RapidoReach OnRewardCenterOpened!");
}
void OnRewardCenterClosed()
{
Debug.Log("RapidoReach OnRewardCenterClosed!");
}
void RapidoReachSurveyAvailable(string available)
{
Debug.Log("RapidoReach RapidoReachSurveyAvailable: " + available);
}
#endif
Google Play Services
A Google Advertising ID helps us serve offers and surveys so we recommend adding Google Play Services to your project. We provide the files to pull this in for you.
iOS
Ensure the UnityPluginBridge.mm and RapidoReachSDK-Bridging-Header.h files and frameworks folder are in your "Assets/Plugins/iOS" folder and the RapidoReach.cs file is in your "Assets/Plugins" folder.
Initialize RapidoReach
We recommend initializing RapidoReach as soon as possible so we can begin preparing surveys for the user. In the Initialize method you'll set your API key and the user's ID that will be passed back into your server side callback when the user has earned currency for completing a survey.