fabiberlin / android-bluetooth

Automatically exported from code.google.com/p/android-bluetooth
0 stars 0 forks source link

scan issues #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. enable bluetooth device;
2. use fllowed code.

                try {

                if(localBtDev.isScanning() == false){
                    //localBtDev.scan();
                }
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
                tv.setText("cann't init 
scanner"+e1.getMessage());
                return;
            }       

What is the expected output? What do you see instead?

it print  cann't init scanner null. what's wrong.

What version of the product are you using? On what operating system?
sdk 1.5 with android-bluetooth api. T-Mobile G1

Please provide any additional information below.

Original issue reported on code.google.com by aurora...@gmail.com on 21 Sep 2009 at 11:45

GoogleCodeExporter commented 8 years ago
This code fragment works as expected:

LocalBluetoothDevice local = LocalBluetoothDevice.initLocalDevice(this);

if (local.isEnabled()) {
   if (! local.isScanning()) {
      local.scan();
   }
}

Be sure, if you enable Bluetooth with
LocalBluetoothDevice.getLocalDevice().setEnabled(true) to wait for the event 
that
notifies that Bluetooth service has been activated. Otherwise it won't work.

Original comment by gerda...@gmail.com on 1 Oct 2009 at 12:18