首页 > 解决方案 > Facebook Audience Network 和 Flutter facebook 广告在 fkutter 中不起作用

问题描述

我正在开发颤振的 facebook 受众网络库 [https://pub.dev/packages/facebook_audience_network]。一切都很好,但发布广告不起作用。卡在 Facebook 仪表板中的接收广告状态。

[main.dart]
    void main(){
     FacebookAudienceNetwork.init();
    }



[view_screen.dart]

    class FaceBookAdScreen extends StatefulWidget {
      @override
      _FaceBookAdScreenState createState() => _FaceBookAdScreenState();
    }
    
    class _FaceBookAdScreenState extends State<FaceBookAdScreen> {
    
      @override
      void initState() {
        // TODO: implement initState
        super.initState();
        FacebookAudienceNetwork.init(
          //testingId: "353da801-f840-4041-8610-10ca1ad1abe1", //optional
        );
    
      }
    
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('facebook ad'),
              Container(
                alignment: const Alignment(0.5, 1),
                child: FacebookNativeAd(
                  placementId: '1088107105005052_1088109968338099',//'1088107105005052_1088109968338099',
                  adType: NativeAdType.NATIVE_AD,
                  height: 300,
                  backgroundColor: Colors.orange,
                  titleColor: Colors.white,
                  descriptionColor: Colors.white,
                  buttonColor: Colors.orange,
                  buttonTitleColor: Colors.white,
                  buttonBorderColor: Colors.white,
                  keepAlive: true, //set true if you do not want adview to refresh on widget rebuild
                  keepExpandedWhileLoading: false, // set false if you want to collapse the native ad view when the ad is loading
                  expandAnimationDuraion: 300, //in milliseconds. Expands the adview with animation when ad is loaded
                  listener: (result, value) {
                    print("Native Ad: $result --> $value");
                  },
                ),
              )
            ],
          ),
        );
      }
    }

测试版广告有效,但发布版无效。为什么?

标签: flutterfacebookfacebook-audience-network

解决方案


推荐阅读