cdlugatiman / backport-android-bluetooth

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

Bluetooth Chat doesn't seem to work on Hero #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I am using the latest svn version of backport-android-bluetooth and
just deployed it to my Hero (with rom HTC Generic 2.73.405.66 not rooted).

When I launch the bluetooth application it runs, but when I try to detect
devices I get null for every names.

I attached the logcat containing what happened starting from the run of the
app and I made my phone discoverable and after I tried to discover phones.

I didn't try yet to pair it with another phone and try exchanging message,
but I will in the next hour :)

Original issue reported on code.google.com by victor.n...@gmail.com on 29 Apr 2010 at 12:13

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, I did some tests and phones don't pair with the app.

When they are paired before from settings, bluetooth chat just crashes.

This is the error:
E/AndroidRuntime(  500): Uncaught handler: thread main exiting due to uncaught 
exception
E/AndroidRuntime(  500): java.lang.RuntimeException: Unable to start activity
ComponentInfo{backport.android.bluetooth/com.example.bluetooth.DeviceListActivit
y}:
java.lang.IllegalArgumentException: 00:24:BA:B2:EF:3C,<unknown>,6816268 is not a
valid Bluetooth address
E/AndroidRuntime(  500):        at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
E/AndroidRuntime(  500):        at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
E/AndroidRuntime(  500):        at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
E/AndroidRuntime(  500):        at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime(  500):        at 
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  500):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  500):        at
android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime(  500):        at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime(  500):        at 
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(  500):        at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime(  500):        at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime(  500):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  500): Caused by: java.lang.IllegalArgumentException:
00:24:BA:B2:EF:3C,<unknown>,6816268 is not a valid Bluetooth address
E/AndroidRuntime(  500):        at
backport.android.bluetooth.BluetoothDevice.<init>(BluetoothDevice.java:372)
E/AndroidRuntime(  500):        at
backport.android.bluetooth.BluetoothAdapter.getBondedDevices(BluetoothAdapter.ja
va:367)
E/AndroidRuntime(  500):        at
com.example.bluetooth.DeviceListActivity.onCreate(DeviceListActivity.java:107)
E/AndroidRuntime(  500):        at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1132)
E/AndroidRuntime(  500):        at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
E/AndroidRuntime(  500):        ... 11 more

Original comment by victor.n...@gmail.com on 29 Apr 2010 at 12:57

GoogleCodeExporter commented 9 years ago
"java.lang.IllegalArgumentException: 00:24:BA:B2:EF:3C,<unknown>,6816268 is not 
a"

It is that line... the thing is that a device is initiated only with MAC 
address... so change the lines 366-367 in the BluetoothAdapter.java to:

String address = bonds[i];
address=address.substring(0, address.indexOf(','));
devices.add(new BluetoothDevice(address));

... Then you have to rebuilt the lib. but I don't know how to do this so I 
haven't tested it (is should work though)

Original comment by bodozog...@gmail.com on 8 Jun 2010 at 4:08

GoogleCodeExporter commented 9 years ago
Yes this is the problem. My FIx:
String[] toks = bonds[i].split(",");
String address = toks[0];
devices.add(new BluetoothDevice(address));

However, next problem is:

V/BluetoothDeviceService.cpp(   81): getRemoteNameNative
I/bluetooth_common.cpp(   81): com.ti.btips, /com/ti/btips, com.ti.btips.bmg, 
GetRemoteDeviceName
I/MyApp  (12739): Exception in getBondedDevices java.lang.NullPointerException

Any suggestions?

Original comment by olub...@gmail.com on 2 Jul 2010 at 1:22