Firstly, you need to integrate the ironSource Tapjoy adapter. You can add this to your project via the ironSource mediation manager window.
Then you need to add the Tapjoy Unity Plugin. This will allow you to access Tapjoy SDK methods from your C# code. Download the plugin and import it to your Unity project.
The Tapjoy Unity Plugin uses the External Dependency Manager to install a copy of the Tapjoy iOS SDK and includes a copy of the Tapjoy Android SDK. As we already added the SDK via the adapter in step 1, we do not want to include a second copy (we only want the bridging code). Modify the TJPluginDependencies
file in /Assets/Tapjoy/Editor to remove the iOS references and only include the Android Unity Bridge. Replace the contents of the file with the following:
<dependencies>
<androidPackages>
<repositories>
<repository>https://sdk.tapjoy.com</repository>
</repositories>
<androidPackage spec="com.tapjoy:tapjoy-android-unitybridge:12.11.1@aar"/>
</androidPackages>
</dependencies>
import TapjoyUnity
#if UNITY_ANDROID
Tapjoy.Connect("your_android_sdk_key");
#elif UNITY_IOS
Tapjoy.Connect("your_ios_sdk_key");
#endif
TJPlacement placement = TJPlacement.CreatePlacement("Offerwall");
placement.requestContent();
TJPlacement.OnRequestSuccess += HandlePlacementRequestSuccess;
TJPlacement.OnRequestFailure += HandlePlacementRequestFailure;
TJPlacement.OnContentReady += HandlePlacementContentReady;
TJPlacement.OnContentShow += HandlePlacementContentShow;
TJPlacement.OnContentDismiss += HandlePlacementContentDismiss;
Some of these can replace the ironSource callbacks you may have already implemented. You can see the corresponding callbacks in the table below so that you can easily move any custom logic into the appropriate Tapjoy callbacks:
ironSource Callback | Tapjoy Callback |
---|---|
onOfferwallClosedEvent | OnContentDismiss |
onOfferwallOpenedEvent | OnContentShow |
onOfferwallAvailableEvent | OnContentReady |
OnRequestSuccess
will be called when the content request returns from Tapjoy’s servers. OnContentReady
will be called when the content (Offerwall) is ready to display. At this point you can either display Offerwall, or set some flag so that you know it is ready to display when you need it.
showContent
:if (placement.IsContentReady()) {
placement.ShowContent();
}
This will replace your existing ironSource call:
IronSource.Agent.showOfferwall();
Once the user has dismissed the Offerwall you must request the content again. You cannot show a placement multiple times. We would recommend that you request the placement in the OnContentDismiss
callback so that it is ready to display again the next time a user requests it.
You can now remove any remaining ironSource Offerwall code.
If you are using ironSource LevelPlay, you may use LevelPlay APIs to share with Tapjoy the following privacy flags:
Also, if your app participates in Google Play’s Designed for Families program, or appears in the “Family” section of Google Play, please flag all the app's users as children and use this API of the Tapjoy SDK so that we don't collect the user's GAID.
If you are not using ironSource LevelPlay or if you would like to configure Tapjoy's SDK separately, please follow these guidelines to share with Tapjoy the relevant privacy flags.