title: Phonegap facebook plugin: Not working when native FB app is installed
body: <p>I have used cordova- 2.5.0 &amp; facebook-sdk 3.0.2 in fb plugin.It works fine when device does not have native app installed. when native app is installed nothing is happened.means it cant get current access token of user.Any idea? According to me there are two ways:</p>
  
  <p>1) disable to get access native app just like in <a href="https://stackoverflow.com/questions/12327631/ios-phonegap-plugin-facebook-connect-vs-faceboook-ios-application">ios</a>. But its not right way as if user is allready login in native then he has to login again in my plugin setup. </p>
  
  <p>2)dont know  how to solve this issue.There is no issue with hash key as it is right and works well in ios using my first way.</p>
  
  <p>So my question is that how to prevent to accessing native app? <strong>OR</strong> Is there any other way to solve this issue?</p>
  
  <p>As i dont get anything. when i am going to get user's friend list it shows An <strong>active access token must be used to query information about the current user.,"type":"OAuthException","code":2500</strong>.</p>
  
  <p><strong>cdv-pluggin-fb-connect.js</strong></p>
  
  <pre><code> CDV = ( typeof CDV == 'undefined' ? {} : CDV );
  var cordova = window.cordova || window.Cordova;
  CDV.FB = {
    init: function(apiKey, fail) {
      // create the fb-root element if it doesn't exist
      if (!document.getElementById('fb-root')) {
        var elem = document.createElement('div');
        elem.id = 'fb-root';
        document.body.appendChild(elem);
      }
      cordova.exec(function() {
      var authResponse = JSON.parse(localStorage.getItem('cdv_fb_session') || '{"expiresIn":0}');
      if (authResponse &amp;&amp; authResponse.expirationTime) {
        var nowTime = (new Date()).getTime();
        if (authResponse.expirationTime &gt; nowTime) {
          // Update expires in information
          updatedExpiresIn = Math.floor((authResponse.expirationTime - nowTime) / 1000);
          authResponse.expiresIn = updatedExpiresIn;
  
          localStorage.setItem('cdv_fb_session', JSON.stringify(authResponse));
          FB.Auth.setAuthResponse(authResponse, 'connected');
         }
        }
        console.log('Cordova Facebook Connect plugin initialized successfully.');
      }, (fail?fail:null), 'org.apache.cordova.facebook.Connect', 'init', [apiKey]);
    },
    login: function(params, cb, fail) {
      params = params || { scope: '' };
      cordova.exec(function(e) { // login
          if (e.authResponse &amp;&amp; e.authResponse.expiresIn) {
            var expirationTime = e.authResponse.expiresIn === 0
            ? 0
            : (new Date()).getTime() + e.authResponse.expiresIn * 1000;
            e.authResponse.expirationTime = expirationTime;
          }
          localStorage.setItem('cdv_fb_session', JSON.stringify(e.authResponse));
          FB.Auth.setAuthResponse(e.authResponse, 'connected');
          if (cb) cb(e);
      }, (fail?fail:null), 'org.apache.cordova.facebook.Connect', 'login', params.scope.split(',') );
    },
    logout: function(cb, fail) {
      cordova.exec(function(e) {
        localStorage.removeItem('cdv_fb_session');
        FB.Auth.setAuthResponse(null, 'notConnected');
        if (cb) cb(e);
      }, (fail?fail:null), 'org.apache.cordova.facebook.Connect', 'logout', []);
    },
    getLoginStatus: function(cb, fail) {
      cordova.exec(function(e) {
        if (cb) cb(e);
      }, (fail?fail:null), 'org.apache.cordova.facebook.Connect', 'getLoginStatus', []);
    },
    dialog: function(params, cb, fail) {
      cordova.exec(function(e) { // login
        if (cb) cb(e);
                    }, (fail?fail:null), 'org.apache.cordova.facebook.Connect', 'showDialog', [params] );
    }
  };
  </code></pre>
  
  <p>Thanks in Advance!!</p>