Gavdhaum / android-bluetooth

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

java.lang.reflect.InvocationTargetException #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. while calling scan() it is giving this excception. The following is code 
sniipt for it.
2.
3.
public void startSearach(Context context)
    {
        try
        {
                 localBluetoothDevice=  
LocalBluetoothDevice.initLocalDevice(context);
                 Toast.makeText(this, "1", 
Toast.LENGTH_LONG).show();

            //localBluetoothDevice.setEnabled(boolean);

            //To start scanning (discovery) of surrounding Bluetooth 
devices just invoke the

             bnotification=new BNotification(this);
             Toast.makeText(this, "2", Toast.LENGTH_LONG).show();
             data+="1";
             //localBluetoothDevice.setEnabled(true);
             data+="2";
             Toast.makeText(this, "2", Toast.LENGTH_LONG).show();
             data+="3";
             localBluetoothDevice.setListener(bnotification);
             Toast.makeText(this, "3", Toast.LENGTH_LONG).show();
             data+="4";
             localBluetoothDevice.scan();
             Toast.makeText(this, "4", Toast.LENGTH_LONG).show();
             data+="5";
        }
        catch(Exception e)
        {
            TextView tv=new TextView(this);
            tv.setText(data);
            setContentView(tv);
            Toast.makeText(this, e.toString(), 
Toast.LENGTH_LONG).show();

        }

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

What version of the product are you using? On what operating system?

I am using HTC G1 T mobile.

Please provide any additional information below.

Let me know if you need any other thing. By the way. Good work.

Original issue reported on code.google.com by honestsu...@gmail.com on 9 Aug 2009 at 1:43

GoogleCodeExporter commented 9 years ago
Have you included following permission in the AndroidManifest.xml of your 
application?

<uses-permission android:name="android.permission.BLUETOOTH"/>

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> 

Original comment by gerda...@gmail.com on 10 Aug 2009 at 5:38

GoogleCodeExporter commented 9 years ago
Adding permission solved the issue.

Original comment by gerda...@gmail.com on 11 Aug 2009 at 6:28