title: Share FB.ui function how to catch close event phonegap app
body: <p>when I display a FB share window I would like to know if the user has pressed the close button, is there a way to do it?</p>
  
  <pre><code> var share = function shareInTimeLine(actionTypeName, bookTitle, bookImage, bookLocation,callback)
          {
              var deferred = $q.defer();
  
              if(typeof(FB) != 'undefined')
              {
                  // calling the API ...
                  var obj = {
                      method: 'feed',
                      link: 'http://www.bookcrossingapp.com/',
                      picture: bookImage,
                      name: bookTitle + ' was ' + actionTypeName,
                      caption: 'In ' + bookLocation,
                      description: bookTitle + ' was ' + actionTypeName + ' in BookCrossing app'
                  };
  
                  FB.ui(obj, function(response){
  
                      if(response != undefined)
                      {
                          $rootScope.$apply(function () {
                          deferred.resolve(response);
                          });
                      }
                      else
                      {
                          alert("X pressed");
                          $rootScope.$apply(function () {
                              deferred.reject(ErrorConst.GenericError);
                          });
                      }
  
                  });
              }
              else
              {
                  deferred.resolve();
              }
  
              return deferred.promise;
          }
  </code></pre>