title: j2me bluetooth client. Function startInquiry nothing found
body: <p>I develop simple j2me bluetooth client and have problem with bluetooth device search.
  Function startInquiry nothing found.</p>
  
  <p>Client : nokia 5220
  Server : my pc with bluetooth adapter</p>
  
  <p>All bluetooth devices is on.</p>
  
  <p>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */</p>
  
  <pre><code>import javax.microedition.midlet.*;
  import javax.bluetooth.*;
  import java.util.Vector;
  import javax.microedition.lcdui.*;
  
  /**
   * @author Администратор
   */
  public class Midlet extends MIDlet implements DiscoveryListener
  {
      private static Vector vecDevices=new Vector();
      private static String connectionURL=null;
      private LocalDevice localDevice;
      private DiscoveryAgent agent;
      private RemoteDevice remoteDevice;
      private RemoteDevice[] devList;
      private Display display;
      private Form form;
  
      public void startApp() {
          display = Display.getDisplay(this);
          form = new Form( "Client" );
          try {
              localDevice = LocalDevice.getLocalDevice();
          } catch( BluetoothStateException e ) {
              e.printStackTrace();
          }
  
          form.append("Address: "+localDevice.getBluetoothAddress()+"\n\n");
          form.append("Name: "+localDevice.getFriendlyName()+"\n\n");
  
          try {
              agent = localDevice.getLocalDevice().getDiscoveryAgent();
  
              form.append("Starting device inquiry... \n\n");
  
              boolean si = agent.startInquiry(DiscoveryAgent.GIAC,  this);
              if ( si ) {
                  form.append("true");
              } else {
                  form.append("false");
              }
          } catch( BluetoothStateException e ) {
          }
  
          int deviceCount = vecDevices.size();
          if(deviceCount &lt;= 0){
              form.append("No Devices Found .");
          }
          else{
              //print bluetooth device addresses and names in the format [ No. address (name) ]
              form.append("Bluetooth Devices: ");
              for (int i = 0; i &lt; deviceCount; i++) {
                  remoteDevice=(RemoteDevice)vecDevices.elementAt(i);
                  form.append( remoteDevice.getBluetoothAddress() );
              }
          }
  
              display.setCurrent(form);
      }
  
      public void pauseApp() {
      }
  
      public void destroyApp(boolean unconditional) {
      }
  
          public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
                //add the device to the vector
                if(!vecDevices.contains(btDevice)){
                    vecDevices.addElement(btDevice);
                }
          }
          public void inquiryCompleted(int discType)
          {
          }
  
  
            //implement this method since services are not being discovered
            public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
                if(servRecord!=null &amp;&amp; servRecord.length&gt;0){
                    connectionURL=servRecord[0].getConnectionURL(0,false);
                }
            }
            //implement this method since services are not being discovered
            public void serviceSearchCompleted(int transID, int respCode) {
            }
  }
  </code></pre>