Skip to main content

SDK Integration

TradPlus_Flutter_SDK Import#

Flutter Version: flutter: ">=2.5.0"

1.pub.dev#

You can use pub.dev Integrate TradPlus_Flutter_SDK

  • Install via command
flutter pub add tradplus_sdk
  • or add dependencies to the project's pubspec.yaml and execute flutter pub get
dependencies:
tradplus_sdk: ^1.1.7
  • Then import
import 'package:tradplus_sdk/tradplus_sdk.dart';

2.Download integration#

Step 1:Download TradPlus_Flutter_SDK#

The SDK contains the following files:

res:default native ad layout

tradplus_sdk:flutter platform tradplus plugin

Step 2: Create a plugins folder in the project directory and put the downloaded SDK plug-in into the plugins folder#

As shown:

Step 3: Add local dependencies to the project pubspec.yaml#
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
# add TradPlus Flutter SDK
tradplus_sdk:
path: plugins/tradplus_sdk/
Step 4: Import#
import 'package:tradplus_sdk/tradplus_sdk.dart';

Platform Configuration#

(1)Android#

Step 1:Download Platform#

  • Select Android as the access method and download the SDK
  • Developers need to confirm whether the project is AndroidX or Support. Introducing errors will cause the project to fail to compile.

Step 2:Import SDK#

After selecting the ad source you want to access, click the "Generate Access Code" button to obtain the required Gradle reference, As shown:

Developers need to add the reference of the Maven library to the project-level build.gradle, As shown:

Add the Gradle reference part to the build.gradle file in the app, As shown:

Step 3:SDK Configuration#

In this step, developers need to configure the AndroidManifest file

Developers can refer to Android SDK Configuration Configure in project engineering

(2)IOS#

There are two ways to import SDK: cocopods import and download import

cocopods import SDK#

1、 Please go to iOS packaging platform to download relevant SDK , select Yes for Use Cocoapod

2、Select the platform you want to integrate

3、Select Generate Code

Modify the generated code to:

s.dependency 'TradPlusAdSDK', '7.8.10'
s.dependency 'TradPlusAdSDK/FacebookAdapter', '7.8.10'
s.dependency 'FBAudienceNetwork','6.11.1'
s.dependency 'TradPlusAdSDK/AdMobAdapter', '7.8.10'
s.dependency 'Google-Mobile-Ads-SDK','9.7.0'
s.dependency 'TradPlusAdSDK/AppLovinAdapter', '7.8.10'
s.dependency 'AppLovinSDK','11.4.3'
s.dependency 'TradPlusAdSDK/PangleAdapter', '7.8.10'
s.dependency 'Ads-CN/International', '4.5.1.6'
s.dependency 'Ads-CN/BUAdSDK', '4.5.1.6'

3.Add the modified configuration to tradplus_sdk.podspec

download import#

1、Please go to iOS packaging platform to download relevant SDK , select NO for Use Cocoapod

2、Check the platform you want to integrate, select Generate Code and download the SDK zip package

3、Place the unzipped TradPlusFrameworks folder in the plugin iOS directory

3. Add configuration in ios/Runner/Info.plist#

  • Http access request permissions
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
  • Configure App Tracking Transparency (IDFA) authorization
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized advertisements to you.</string>

It is recommended to add IDFA authorization code in ios/Runner/AppDelegate

Objc-C

#import <AppTrackingTransparency/AppTrackingTransparency.h>
if (@available(iOS 14.5, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
}];
}

swift

import AppTrackingTransparency
if #available(iOS 14.5, *) {
ATTrackingManager.requestTrackingAuthorization { status in
}
}
  • Setting SKNetworkID

Third-party SKNetworkID configuration

  • If you use Admob or GoogleAdManager, you need to add the following configuration:

     The product's unique identifier in Admob must be written in the client, otherwise the application will crash.

     Add GADApplicationIdentifier configuration in Info.plist. When publishing the app, please replace it with the appid of the app in the Admob backend.

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>