Note that there are some explanatory texts on larger screens.

plurals
  1. POPairing with SPP bluetooth device crashes Samsung Galaxy S (Android 2.2)
    primarykey
    data
    text
    <p>I've written an app for Android that attempts to connect to a serial bluetooth device, using some simple code:</p> <pre><code>UUID wellKnownSerialUuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); BluetoothDevice device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice("ff:ff:ff:ff:ff:ff"); // fake address :) BluetoothSocket socket = device.createRfcommSocketToServiceRecord(wellKnownSerialUuid); socket.connect(); socket.close(); </code></pre> <p>This code works fine on an LG Optimus One (running Android 2.2). However it crashes on a Samsung Galaxy S (also running Android 2.2) with the following call stack:</p> <pre><code>FATAL EXCEPTION: main ComponentInfo{com.android.settings/com.android.settings.bluetooth.BluetoothPairingDialog}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) at android.app.ActivityThread.access$2300(ActivityThread.java:125) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.android.settings.bluetooth.BluetoothPairingDialog.isDeviceKeyboard(BluetoothPairingDialog.java:343) at com.android.settings.bluetooth.BluetoothPairingDialog.createView(BluetoothPairingDialog.java:222) at com.android.settings.bluetooth.BluetoothPairingDialog.createUserEntryDialog(BluetoothPairingDialog.java:191) at com.android.settings.bluetooth.BluetoothPairingDialog.onCreate(BluetoothPairingDialog.java:139) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) </code></pre> <p>This crash occurs whilst the .connect() method is blocked. A NullPointerException is occurring in isDeviceKeyboard() in BluetoothPairingDialog.java line 343, which is in the process of trying to display the bluetooth pairing dialog during the call to connect(). I've been trying to find the source for that file on the web, but only turned up incorrect versions of BluetoothPairingDialog.java that don't have a line 343 (e.g. via <a href="http://grepcode.com/search?query=bluetoothpairingdialog&amp;n=" rel="nofollow">GrepCode</a>).</p> <p>Can anyone point me to the correct source, or even better, suggest how I can work around this crash? I don't believe I have any control over the display of the pairing dialog (for security reasons)...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload