title: PhoneGap setKeepCallback - What does it?
body: <p>i made a project, where i established a successfull communication from my bluetooth plugin to my javascript. From my Javascript i register a callback to my plugin that way in java:</p>
  
  <pre><code>if (action.equals(ACTION_REGISTER_CALLBACK)) {
  
              if(mJSCallback != null) {
                  pluginResult = new PluginResult(PluginResult.Status.ERROR, "An event callback has already been registered.");
              } else {
                  mJSCallback = callbackId;
                  pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
                  pluginResult.setKeepCallback(true);
              }
  
          }
  </code></pre>
  
  <p>this is of course done in the exec function. because of the fact, that bluetooth events come not at certain points of time, i registered a broadcast receiver, that sends messages to my javascript, when theres is found an device for example.</p>
  
  <pre><code>if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
  
      sendMessagetoJSCallback(new PluginResult(PluginResult.Status.OK, "Discovery finished."));
  
  }
  </code></pre>
  
  <p>The belonging function for sending:</p>
  
  <pre><code>public void sendMessagetoJSCallback(PluginResult res) {
      res.setKeepCallback(true);
      success(res, mJSCallback);
  }
  </code></pre>
  
  <p>What i did not really understand in that context is, what setKeepCallback does in those different functions. I thought there would be a documentation, but there isnt.</p>
  
  <p>Can someone tell me?
  I orientated the development on <a href="https://github.com/phonegap/phonegap-plugins/tree/master/Android/PhoneListener" rel="noreferrer">https://github.com/phonegap/phonegap-plugins/tree/master/Android/PhoneListener</a></p>