0

我正在尝试将 AdColony SDK for Admob 中介集成到我的 Flutter 应用程序中。一切都很好,除了一件事,即

集成需要我添加一些本机代码行以禁用测试广告并将 GDPR 值发送到 AdColony 网络

这些行是:

// Set app-level configurations
AdColonyAppOptions.SetTestMode(false);


using GoogleMobileAds.Api.Mediation.AdColony;
//...
AdColonyAppOptions.SetGDPRRequired(true);
AdColonyAppOptions.SetGDPRConsentString("1");

您可能知道,MainActivity.kt 中的代码是:

import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import com.adcolony.sdk.AdColonyAppOptions

class MainActivity: FlutterActivity() {
    private val CHANNEL = "com.flutter.adColony/disableTest"

    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
            call, result ->
            if (call.method == "Disable") {
                AdColonyAppOptions.SetTestMode(false)
            }
        }
    }
}

每当我尝试运行我的应用程序时,都会收到此错误:

/Users/Desktop/flutter/app/android/app/src/main/kotlin/example/app/MainActivity.kt: (17, 17): Unresolved reference: SetTestMode

4

0 回答 0