diff --git a/android/src/main/kotlin/io/vinicius/appodeal_flutter/AppodealFlutterPlugin.kt b/android/src/main/kotlin/io/vinicius/appodeal_flutter/AppodealFlutterPlugin.kt index 29b0fbd..d7c9eb4 100644 --- a/android/src/main/kotlin/io/vinicius/appodeal_flutter/AppodealFlutterPlugin.kt +++ b/android/src/main/kotlin/io/vinicius/appodeal_flutter/AppodealFlutterPlugin.kt @@ -85,15 +85,16 @@ class AppodealFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { val adTypes = args["adTypes"] as List val testMode = args["testMode"] as Boolean val verbose = args["verbose"] as Boolean + val userId = args["userId"] as String // Registering callbacks setCallbacks() val ads = adTypes.fold(0) { acc, value -> acc or getAdType(value) } + if (userId != "") Appodeal.getUserSettings(activity).setUserId(userId) Appodeal.setTesting(testMode) Appodeal.initialize(activity, appKey, ads, hasConsent) if (verbose) Appodeal.setLogLevel(Log.LogLevel.verbose) - result.success(null) } diff --git a/example/lib/main.dart b/example/lib/main.dart index 098ac4f..81407c1 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -43,7 +43,9 @@ class _MyAppState extends State { await Appodeal.initialize( hasConsent: true, adTypes: [AdType.banner, AdType.mrec, AdType.interstitial, AdType.reward, AdType.nonSkippable], - testMode: true); + testMode: true, + userId: 'User#123', // For S2S rewarded video callbacks + ); setState(() => isAppodealInitialized = true); }); diff --git a/lib/src/appodeal.dart b/lib/src/appodeal.dart index 7ef7f2b..943b2c4 100644 --- a/lib/src/appodeal.dart +++ b/lib/src/appodeal.dart @@ -31,7 +31,7 @@ class Appodeal { /// also if ads should be presented in test mode [testMode] or not. Always set test mode as `true` during development /// or tests. static Future initialize( - {required bool hasConsent, List adTypes = const [], bool testMode = false, bool verbose = false}) async { + {required bool hasConsent, List adTypes = const [], bool testMode = false, bool verbose = false, String userId = ''}) async { assert(_androidAppKey != null || _iosAppKey != null, 'You must set at least one of the keys for Android or iOS'); // Register the callbacks @@ -44,6 +44,7 @@ class Appodeal { 'adTypes': adTypes, 'testMode': testMode, 'verbose': verbose, + 'userId' : userId, }); }