title: Android Facebook Native ads error: 1001 no fill on user device
body: <p>Our application use <strong>Facebook Native Ad</strong> via mediation platform Mopub, and it works good, but we should move to another platform.</p>
  
  <p>I've replaced SDK platform, using the same placementId and app_id and tested my application as Developer. 
  Everything works good in test mode with real ads also, but I cannot get ads on real devices. </p>
  
  <p>I tried to implement Facebook Native without any mediation platforms(code in the bottom), but still have the same result. </p>
  
  <p>So the issue is not in partner platform,but I cannot get ads on real devices. Facebook Native throws error: <strong>1001 no fill</strong></p>
  
  <p>It looks very strange, because I have:</p>
  
  <ul>
  <li>Application has real users and shows ads in the previous version.</li>
  <li>Application in PlayMarket(but with the previous implementation) with same package Id, placementId and app_id.</li>
  <li>Facebook has checked my app.</li>
  <li>I can see requests from new and previous version.</li>
  </ul>
  
  <p>Code and logs:
  AndroidManifest:
      //...
          </p>
  
  <pre><code>//...
       &lt;meta-data
          android:name="com.facebook.sdk.ApplicationId"
          android:value="@string/app_id" /&gt;
  </code></pre>
  
  <p>Application build.gradle:</p>
  
  <pre><code>//...
  ext {
      supportLibraryVersion = '25.3.1'
      playServicesVersion = '11.0.1'
      FBVersion = "4.25.0"
  }
  
  dependencies {
      compile project(':library')
      compile fileTree(include: ['*.jar'], dir: 'libs')
  //...
      compile "com.facebook.android:audience-network-sdk:$FBVersion"
  //...
  }
  </code></pre>
  
  <p>FacebookNativeLoader.java:</p>
  
  <pre><code>//...
      /**
       * Initiate ad container for native ad
       */
      Override
      public View createContentView(Context context) {
          log(" createContentView");
          LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          return inflater.inflate(R.layout.facebook_ad_native_view, null);
      }
  
  
      @Override
      public void loadAd(final MyViewManager myViewManager, final ResultListener resultListener) {
          log(" loadAd");
          adNativeLayout = myViewManager.getContentView();
  
          // Create ad request with Facebook ad PlacementId
          adNative = new NativeAd(myViewManager.getContext(), adPlacementId);
  
          //
          adNative.setAdListener(new AdListener() {
              @Override
              public void onError(Ad ad, AdError adError) {
                  log("FacebookNative Ad Loading Failed." + 
                          "Error:" + NATIVE_LOAD_ERROR + 
                              "  ErrorCode:" + adError.getErrorCode() + 
                                  " ErrorMessage" + adError.getErrorMessage());
  
                  //Call Error to hide ad layout
                  resultListener.onError(NATIVE_LOAD_ERROR);
              }
  
              @Override
              public void onAdLoaded(Ad ad) {
                  log("FacebookNative Ad Loading Completed");
  
  //...
  
                  // Download icon for native ad
                  if (adNative.getAdIcon() != null) {
                      String iconUrl = adNative.getAdIcon().getUrl();
                      if (iconUrl != null &amp;&amp; iconUrl.length() &gt; 0) 
                          NativeAd.downloadAndDisplayImage(adNative.getAdIcon(), icon);
                  }
  
                  // Download cover for native ad
                  if (adNative.getAdCoverImage() != null) {
                      String coverUrl = adNative.getAdCoverImage().getUrl();
                      if (coverUrl != null &amp;&amp; coverUrl.length() &gt; 0) 
                          NativeAd.downloadAndDisplayImage(adNative.getAdCoverImage(), contentImage);
                  }
  
                  //Show debug info
                  log("adNative.getCalltoAction() - " + adNative.getAdCallToAction());
                  log("adNative.getBody() - " + adNative.getAdBody());
                  log("adNative.getClickUrl() - " + adNative.getAdCallToAction());
  
  
                  BaseLockScreenManager.url = adNative.getAdCallToAction();
                  title.setText(adNative.getAdTitle());
                  text.setText(adNative.getAdSubtitle());
                  downloadButton.setText(adNative.getAdCallToAction());
  
                  // Add the AdChoices icon
                  LinearLayout adChoicesContainer = (LinearLayout) adNativeLayout.findViewById(R.id.ad_choices_container);
                  AdChoicesView adChoicesView = new AdChoicesView(myViewManager.getContext(), adNative, true);
                  adChoicesContainer.addView(adChoicesView);
  
                  //Call Success to show ads
                  resultListener.onSuccess(true);
              }
  
              @Override
              public void onAdClicked(Ad ad) {
                  //Do something
              }
  
              @Override
              public void onLoggingImpression(Ad ad) {
                  //Do something
              }
          });
  
          //Register Ad container to catch user Interactions
          adNative.registerViewForInteraction(adNativeLayout);
  
          // Initiate a request to load an ad.
          // Loading Ad started here...
          adNative.loadAd();
      }
  </code></pre>
  
  <p><strong>In Facebook documentation "error: 1001 no fill" means:</strong></p>
  
  <blockquote>
    <p>This is a common error seen while testing, and relates to a "No Fill"
    response; the most common reason for this is the user is not logged in
    to the Facebook App when testing your mobile app or not logged in to
    the Facebook mobile website when testing your mobile website.</p>
    
    <p><strong>Error 1001 - No Fill. May be due to one or more of the following:</strong>
     - User not logged into Native Facebook App on Mobile Device(But real device logged into Native Facebook App)</p>
    
    <ul>
    <li>Limit Ad Tracking turned on (iOS)(but this is not relevant for Android app)</li>
    <li>Opt out of interest-based ads turned on (Android) (but I've turned value off)</li>
    <li>No Ad Inventory for current user (What does it mean?)</li>
    <li>Your testing device must have the native Facebook application installed.(but I tested on real device with real Facebook account)</li>
    <li>Your application should attempt to make another request after 30 seconds.(but I'have the same result everytime)</li>
    </ul>
  </blockquote>
  
  <p><em>LogCat messages:</em></p>
  
  <p><strong>Developer device:</strong></p>
  
  <pre><code>FacebookLoader:
      I/----FacebookLoader:  loadAd
      I/----FacebookLoader:  createContentView
      I/----FacebookLoader: Facebooknative Ad Loading Completed
      I/----FacebookLoader: adNative.getCalltoAction() - Learn More
      I/----FacebookLoader: adNative.getBody() - LAToken aims to tokenize assets worth $1.2 trillion by 2025.
      I/----FacebookLoader: adNative.getClickUrl() - Learn More
  </code></pre>
  
  <p><strong>User Device:</strong></p>
  
  <pre><code>FacebookLoader:
      I/----FacebookLoader:  loadAd
      I/----FacebookLoader:  createContentView
      I/----FacebookLoader: FacebookNative Ad Loading Failed.Error:669  ErrorCode:1001 ErrorMessage: No fill
  </code></pre>
  
  <p>What can be issue of it? Has somebody the same issue?</p>
  
  <p>I'm afraid to make release without ability to be sure that user can see ads, because the main idea of our application is Advertisement.</p>