Quickstart

1. Minimum Requirements

  • Flutter: 3.3.0
  • Dart: 3.0.0
  • iOS: 12.0
  • Android: 5.0 (API 21)

2. SDK Integration

The first step in integrating with your app is to install the Tapjoy Flutter Plugin.

Pub.dev

flutter pub add tapjoy_offerwall

You can then import Tapjoy into your application to use the plugin:

import 'package:tapjoy_offerwall/tapjoy_offerwall.dart';

3. Connect to Tapjoy

The connect call is how we initialise the Tapjoy SDK. You should do this as soon as possible after your app launches

final Map<String, dynamic> optionFlags = {};

Tapjoy.connect(
    sdkKey:
        'SDK_KEY',
    options: optionFlags,
    onConnectSuccess: () async {

    },
    onConnectFailure: (int code, String? error) async {

    },
    onConnectWarning: (int code, String? warning) async {

    });

Once you have finished configuing Tapjoy you can build and run your application.

Congratulations! You now have Tapjoy working in your application.

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 calling setUserSegment. This can be set before or after calling connect.

Tapjoy.setUserSegment(TJSegment.nonPayer);
Tapjoy.setUserSegment(TJSegment.payer);
Tapjoy.setUserSegment(TJSegment.vip);
Tapjoy.setUserSegment(TJSegment.unknown);

4. 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 the app_tracking_transparency package:

flutter pub add app_tracking_transparency

Import the library, and then show the permission dialog:

import 'package:app_tracking_transparency/app_tracking_transparency.dart';

...

final status = await AppTrackingTransparency.requestTrackingAuthorization();