Quickstart
Import the Tapjoy Unity plugin package into your project, configure SDK keys, and add the Tapjoy GameObject to your first scene to begin integration.
Read time 2 minutesLast updated 3 hours ago
Minimum Requirements
- React Native: 0.71.6
- Node 14 or newer
- Ruby 2.7.6
- iOS: 13.0
- Android: 5.0 (API 21)
SDK Integration
The first step in integrating with your app is to install the Tapjoy React Native Plugin. We support NPM and Yarn.NPM
When using NPM you need to add our Maven repository to your Android App or Project level build.gradle file.Then you can install the plugin.repositories { maven { url "https://sdk.tapjoy.com/" } }
npm install tapjoy-react-native-sdk
Yarn
You can then import Tapjoy into your application to use the plugin:yarn add tapjoy-react-native-sdk
import {Tapjoy, TJPlacement} from 'tapjoy-react-native-sdk'
Add App Permissions (for Android)
TheACCESS_WIFI_STATE
<manifest ...> ... <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> ... </manifest>
Connect to Tapjoy
The connect call is how we initialise the the Offerwall SDK. Do this as soon as possible after your app launchesA warning will occur when there is a non-blocking issue during connect. Success will occur after. Currently this feature will only detect issues with UserId when sent in ConnectFlags. When you have finished configuing Tapjoy you can build and run your application.try { let sdkKey = Platform.OS === 'ios' ? 'ios-sdk-key' : 'android-sdk-key' let flags: object = { TJC_OPTION_USER_ID: 'userId' }; await Tapjoy.connect(sdkKey, flags, (event: TapjoyEvent) => { // Handle Warning }, ); // Handle Success } catch (error: any) { // Handle Failure }
Logging
You can get and set the logging level by using the following methods.// Set logging level Tapjoy.setLoggingLevel(TJLoggingLevel.Debug); // Get logging level var loggingLevel = await Tapjoy.getLoggingLevel();
Max User Level
You can tell Tapjoy how many levels there are in your game. You can set this value before or after calling connect.Tapjoy.setMaxLevel(10);
User Segment
You can identify users as part of a segment by callingsetUserSegment
Tapjoy.setUserSegment(TJSegment.VIP); Tapjoy.setUserSegment(TJSegment.Payer); Tapjoy.setUserSegment(TJSegment.NonPayer); Tapjoy.setUserSegment(TJSegment.Unknown);
Request App Tracking Transparency authorization
If your application is designed to use App Tracking Transparency, to display the dialog to request permission for accessing the IDFA, update your Info.plist by including the NSUserTrackingUsageDescription key along with a custom message to describe this permission to use IDFA in your application. Next install thereact-native-tracking-transparency
Import the library, and then show the permission dialog:yarn add react-native-tracking-transparency
import { getTrackingStatus, requestTrackingPermission, } from 'react-native-tracking-transparency'; ... let trackingStatus = await getTrackingStatus(); if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') { await Tapjoy.connect(sdkKey, flags); }else{ trackingStatus = await requestTrackingPermission(); await Tapjoy.connect(sdkKey, flags); }