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.
There are two new activities to add to your manifest if you are integrating manually. These relate to the predictive back gesture.
<activity
android:name="com.tapjoy.TJAdUnitActivity"
android:enableOnBackInvokedCallback="false"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/TranslucentTheme"
android:hardwareAccelerated="true"
tools:ignore="UnusedAttribute" />
<activity
android:name="com.tapjoy.TJWebViewActivity"
android:enableOnBackInvokedCallback="false"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/TranslucentTheme"
android:hardwareAccelerated="true"
tools:ignore="UnusedAttribute" />
Tapjoy.setActivity()
. It will be removed in the next major version and no longer does anything.Tapjoy.setGLSurfaceView()
. It will be removed in the next major version and no longer does anything.Tapjoy.trackPurchase()
with trackPurchase(String currencyCode, double price)
.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.
Tapjoy.connect(getContext().getApplicationContext(), "SDK_KEY_GOES_HERE", connectFlags, new TJConnectListener() {
@Override
public void onConnectSuccess() {
}
@Override
public void onConnectWarning(int code, String message) {
}
@Override
public void onConnectFailure(int code, String message) {
}
});
We added error code & message parameters to connectFailure
callback. The previous callback is now deprecated but still functional.
Tapjoy.connect(getContext().getApplicationContext(), "SDK_KEY_GOES_HERE", connectFlags, new TJConnectListener() {
@Override
public void onConnectSuccess() {
super.onConnectSuccess();
}
@Override
public void onConnectFailure(int code, String message) {
super.onConnectFailure(code, message);
}
@Override
public void onConnectFailure() { //Deprecated
super.onConnectFailure();
}
});
It's now possible to set the number of levels in your game. It can be set before or after connect.
Tapjoy.setMaxLevel(10);
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.NON_PAYER);
Tapjoy.setUserSegment(TJSegment.UNKNOWN);
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.
TJPlacement placement = Tapjoy.getPlacement("myPlacement", null);
placement.setEntryPoint(TJEntryPoint.ENTRY_POINT_MAIN_MENU);
placement.requestContent();
// Available values
TJEntryPoint.ENTRY_POINT_UNKNOWN
TJEntryPoint.ENTRY_POINT_OTHER
TJEntryPoint.ENTRY_POINT_MAIN_MENU
TJEntryPoint.ENTRY_POINT_HUD
TJEntryPoint.ENTRY_POINT_EXIT
TJEntryPoint.ENTRY_POINT_FAIL
TJEntryPoint.ENTRY_POINT_COMPLETE
TJEntryPoint.ENTRY_POINT_INBOX
TJEntryPoint.ENTRY_POINT_INIT
TJEntryPoint.ENTRY_POINT_STORE
You can now set the users balance before creating a placement. It must be set before requestContent.
TJPlacement placement = Tapjoy.getPlacement("placement", this);
placement.setCurrencyBalance("1234", 100, new TJSetCurrencyBalanceListener() {
@Override
public void onSetCurrencyBalanceSuccess() {
}
@Override
public void onSetCurrencyBalanceFailure(int code, String error) {
}
});
You can also set the amount of currency a user needs to achieve their goal on each placement.
TJPlacement placement = Tapjoy.getPlacement("placement", this);
placement.setCurrencyAmountRequired("1234", 100, new TJSetCurrencyAmountRequiredListener() {
@Override
public void onSetCurrencyAmountRequiredSuccess() {
}
@Override
public void onSetCurrencyAmountRequiredFailure(int code, String error) {
}
});
Tapjoy now hosts our own maven repository. Bintray will continue to work in the short term, but as it is deprecated we recommend updating to use our repository as soon as you can.
All previous and new releases are available via our repository while only releases pre-12.8.0 will be available going forward on Bintray.
You can use the new repository like so:
repositories {
maven {
name "Tapjoy's maven repo"
url "https://sdk.tapjoy.com/"
}
}
dependencies {
api 'com.tapjoy:tapjoy-android-sdk:12.8.0@aar'
}