Update Guide

This guide describes steps required when updating from one Tapjoy SDK version to another, it's recommended you perform all the steps to prevent any issues or conflicts.

13.4.0

We added a new connectWarning callback. This will fire when there is a non-blocking issue during connect, connectSuccess will also fire after. Currently this feature will only detect issues with UserId when sent in ConnectFlags.

import {
  NativeEventEmitter,
  NativeModules,
} from 'react-native';

const TJ = NativeModules.TapjoyReactNativeSdk;
      const TapjoyEmitter = new NativeEventEmitter(TJ);
      const TapjoyEventType = 'Tapjoy';
      const subscription = TapjoyEmitter.addListener(
        TapjoyEventType,
        (event: TapjoyEvent) => {
          if (event.name === TJConnect.TJC_CONNECT_WARNING) {
            subscription.remove();
            setStatusLabelText(
              `Tapjoy SDK connected with Warning: ErrorCode: ${event.code} ${event.message} `
            );
          }
        }
      );

We also added support for User Tags.

Tapjoy.addUserTag('');
Tapjoy.removeUserTag('');
Tapjoy.clearUserTags();

13.2.0

Connect

We added error code & message parameters to connectFailure callback. The previous callback is now deprecated but still functional.

try {
  await Tapjoy.connect(sdkKey, flags);
} catch (error: any) {
  let errorString = `Tapjoy SDK failed to connect. code: ${error.code}, message: ${error.message}`;
} 

Max User Level

It's now possible to set the number of levels in your game. It can be set before or after connect.

Tapjoy.setMaxLevel(10); 

User Segment

You can now set the type of user currently using your app. This can be set before or after connect, or during the session.

Tapjoy.setUserSegment(TJSegment.VIP);
Tapjoy.setUserSegment(TJSegment.Payer);
Tapjoy.setUserSegment(TJSegment.NonPayer);
Tapjoy.setUserSegment(TJSegment.Unknown);

Entry Point

Before calling request connect you can set the entry point. This describes where in the app the placement will be shown. You can choose from one of several preset values.

let placement = new TJPlacement("myPlacement");
placement.setEntryPoint(TJEntryPoint.TJEntryPointMainMenu);
placement.requestContent(); 

// Available values
TJEntryPointUnknown
TJEntryPointOther
TJEntryPointMainMenu
TJEntryPointHud
TJEntryPointExit
TJEntryPointFail
TJEntryPointComplete
TJEntryPointInbox
TJEntryPointInit
TJEntryPointStore

Currency

  • Get/spend/earn will no longer accept negative values.
  • If self-managed currencies call the managed currency API's, an error will be returned.

You can now set the users balance before creating a placement. It must be set before requestContent.

let placement = new TJPlacement('placementName');
try {
  await placement?.setCurrencyBalance('1234', 100);
} catch (e: any) {
  let code = e.code;
  let message = e.message;
}

You can also set the amount of currency a user needs to achieve their goal on each placement.

let placement = new TJPlacement('placementName');
try {
await offerwallPlacement?.setRequiredAmount(100, '100');
} catch (e: any) {
  let code = e.code;
  let message = e.message;
} 

User Privacy

Updated interface to match the other platforms. Also added support for Android optOutAdvertisingId interface.

let privacyPolicy = new TJPrivacyPolicy();
privacyPolicy.setSubjectToGDPRStatus(TJStatus.True);
privacyPolicy.setBelowConsentAgeStatus(TJStatus.False);
privacyPolicy.setUserConsentStatus(TJStatus.Unknown);
privacyPolicy.setUSPrivacy('1---');
privacyPolicy.optOutAdvertisingID(false);