Quickstart
Set up Tapjoy in Flutter by importing the plugin, adding the SDK key, and initializing it in your app—so you can start requesting placements quickly.
Read time 1 minuteLast updated 3 hours ago
Minimum Requirements
- Flutter: 3.3.0
- Dart: 3.0.0
- iOS: 13.0
- Android: 5.0 (API 21)
SDK Integration
The first step in integrating with your app is to install the Tapjoy Flutter Plugin.Pub.dev
flutter pub add tapjoy_offerwall
Add the Offerwall Maven Repository (Android)
Add the Offerwall Maven repository and Offerwall SDK dependency to your android/app/build.gradle file.You can then import Tapjoy into your application to use the plugin:repositories { maven { name "Tapjoy's maven repo" url "https://sdk.tapjoy.com/" } } dependencies { implementation 'com.tapjoy:tapjoy-android-sdk:14.4.0' }
import 'package:tapjoy_offerwall/tapjoy_offerwall.dart';
Connect to Tapjoy
The connect call is how we initialise the Offerwall SDK. Do this as soon as possible after your app launchesWhen you have finished configuing Tapjoy you can build and run your application.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 { });
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.nonPayer); Tapjoy.setUserSegment(TJSegment.payer); Tapjoy.setUserSegment(TJSegment.vip); 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 theapp_tracking_transparency
Import the library, and then show the permission dialog:flutter pub add app_tracking_transparency
import 'package:app_tracking_transparency/app_tracking_transparency.dart'; ... final status = await AppTrackingTransparency.requestTrackingAuthorization();