title: Why does Facebook give me an empty response on Android?
body: <p>I've inherited a Facebook app, which doesn't work 100% as intended. I don't understand the logic of the previous developer, but I'm not strong enough in the Facebook API to rewrite it.</p>
  
  <p>The app has a form, in which the user (when logged in) needs to answer a few questions. When he clicks submit, we want to check whether or not he likes the page. The form will only be submitted if he does.</p>
  
  <pre class="lang-js prettyprint-override"><code>window.fbAsyncInit = function() {
    FB.init({
      appId      : '[myappid]',              
      channelUrl : '//www.myurl.com/channel.aspx',
      status     : true,
      cookie     : true,
      xfbml      : true
     });
   };
  
  $("form input[type='submit']").on("click", function(e) {
    e.preventDefault();
    setTimeout(function() {
      FB.api('/me/likes/MY-PAGE-ID',function(response) {
        if(response.data) {
         alert(response.data); // I get this (empty) alert
         if(!isEmpty(response.data)) {
           alert('all ok'); // I never get this :(
           //$("form").submit();
         } else {
           alert("You must \"Like\" the page."); // Every time
         }
       }
     });
   }, 1000);
  // Unrelated code edited out - end brackets may not match 100%
  
  function isEmpty(obj) {
    for(var prop in obj) {
        if(obj.hasOwnProperty(prop))
            return false;
    }
    return true;
   }
  </code></pre>
  
  <p>Now, on desktop this works as intended. However, on Android it doesn't. It does enter the first <code>if(response.data) {</code> but the following alert box which should return the data, returns empty. It therefore never enters the following if-statement.</p>
  
  <p>The part I don't understand, is why it enters the first if (<code>response.data</code> exists) but not the second (because the response is somehow empty, even if the page is liked).</p>
  
  <p>I don't have a different device to test on, sadly.</p>
  
  <p>Am I overlooking some obvious glaring mistake? What can I do to salvage it?</p>