[android-developers] Re: Bluetooth RFCOMM connection dying immediately after .connect()
So here is the status regarding a similar issue I am having with the bluetooth connection. Works on HTC Legened and Google Nexus 1 Fails on the HTC Desire what sucks is that normally the HTC Desire and N1 are supposedly based on the same hardware. I checked the firmware version between the two and they are the same however the kernel version seems to be different. HTC Desire is kernel 2.6.29-97 (Built by HTC I presume) Nexus 1 is 2.6.29-01117 Serge -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: 2.1 Bluetooth support still needs work
Hello, Yes I can confirm the same. I have a solution working for example under the HTC Legend but fails using the HTC Desire and the failure apears to be at a fairly low level. Serge On Apr 20, 2:28 pm, Anders Widen wrote: > Hi! > > I've been working with bluetooth trying figure things out using the > BTChatExample. Without editing BTChat has errors that destroy the > functionality. You can only connect the first time, if you connect. > Close the program and doesn't restart bluetooth the program crashes. > Even if you edit out the AccepThread and only focus on client connect, > the program will cast exceptions. > > "JBtlSpp.create failed with status FAILED" > > when trying to connect. I've looked into the code and referenced it > with the docs (that are based around the ChatExample) and either > bluetooth still needs work or there something missing in the APIs. > > I would love to hear from other people trying to use Bluetooth on > Android 2.0++, or try to get a hold of a framework developer to try to > iron out these that I believe are in the framework itself. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Android Bluetooth Development - Problem connecting
Hi Guys, I am having the same issue with code which worked fine on the HTC Legend and now fails on the HTC Desire. Could you report which handsets you are using as well. I would like to establish if this could be some sort of timing related issue. Thanks, Serge On Apr 18, 12:32 am, Max wrote: > Hi Phil! > > I just found your post and thought I'd chime in. > > Funnily enough I'm just spending second day trying to connect to a > device with very similar signature to yours and I'm using code which > is pretty much the same as yours and, of course, I can't make it work > as well so I thought we could coordinate our efforts. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Bluetooth SPP not working on HTC Desire
Hello, I have been doing some Bluetooth SPP development with an HTC Legend which was working just fine. Today I received my HTC Desire and I cant get an SPP connection to work. The first thing I had to do is remove the mAdapter.cancelDiscovery() call in the connectThread(). It seems there is some sort of timing issue here and with the faster processor its not working like this. Below is an extract from the logs when mAdapter.cancelDiscovery() was being called just prior to mmSocket.connect(); 04-19 16:30:58.984: DEBUG/BluetoothSppService(759): Running mConnectThread 04-19 16:30:58.984: ERROR/BluetoothEventLoop.cpp(92): pollData[0] is revented, check next one 04-19 16:30:58.984: ERROR/BluetoothService.cpp(92): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session) 04-19 16:30:59.024: DEBUG/DEVICE(293): BLTA - *DiscoverServices I get a little farther after this change and it almost seems as if the connection is up because the BT Icon on my laptop changes to green but then the connection fails anyway. Here is an extract of the stack after the call to mmSocket.connect(); 04-19 16:33:40.314: DEBUG/DEVICE(293): BLTA - *DiscoverServices 04-19 16:33:40.314: INFO/DTUN_HCID_BZ4(293): dtun_client_get_remote_svc_channel: starting discovery on (uuid16=0x0011) 04-19 16:33:40.314: INFO/DTUN_HCID_BZ4(293): bdaddr=00:23:4D:F3:3B:BE 04-19 16:33:40.314: INFO/DTUN_CLNT(293): Client calling DTUN_METHOD_DM_GET_REMOTE_SERVICE_CHANNEL (id 4) 04-19 16:33:40.314: INFO/(260): DTUN_ReceiveCtrlMsg: [DTUN] Received message [BTLIF_DTUN_METHOD_CALL] 4354 04-19 16:33:40.314: INFO/(260): handle_method_call: handle_method_call :: received DTUN_METHOD_DM_GET_REMOTE_SERVICE_CHANNEL (id 4), len 134 04-19 16:33:40.314: ERROR/BTLD(260): search UUID = 1101*** 04-19 16:33:40.314: INFO//system/bin/btld(256): btapp_dm_GetRemoteServiceChannel() 04-19 16:33:40.314: INFO//system/bin/btld(256): # USerial_Ioctl: BT_Wake, 0x8003 04-19 16:33:40.914: INFO//system/bin/btld(256): # USerial_Ioctl: BT_Sleep, 0x8004 04-19 16:33:41.394: WARN/BTLD(260): ccb timer ticks: 0 04-19 16:33:41.394: INFO//system/bin/btld(256): # USerial_Ioctl: BT_Wake, 0x8003 04-19 16:33:41.464: WARN/BTLD(260): info:x10 04-19 16:33:41.464: INFO/BTL-IFS(260): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 10 pbytes (hdl 14) 04-19 16:33:41.464: DEBUG/DTUN_HCID_BZ4(293): dtun_dm_sig_link_up() 04-19 16:33:41.464: INFO/DTUN_HCID_BZ4(293): dtun_dm_sig_link_up: dummy_handle = 260 04-19 16:33:41.464: DEBUG/ADAPTER(293): adapter_get_device(00:23:4D:F3:3B:BE) 04-19 16:33:41.464: ERROR/BluetoothEventLoop.cpp(92): pollData[0] is revented, check next one 04-19 16:33:41.464: ERROR/BluetoothEventLoop.cpp(92): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/293/ hci0/dev_00_23_4D_F3_3B_BE 04-19 16:33:41.584: WARN/BTLD(260): process_service_search_attr_rsp 04-19 16:33:41.624: INFO/BTL-IFS(260): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 13 pbytes (hdl 14) 04-19 16:33:41.624: INFO/DTUN_HCID_BZ4(293): dtun_dm_sig_rmt_service_channel: success=0, service= 04-19 16:33:41.624: ERROR/DTUN_HCID_BZ4(293): discovery unsuccessful! 04-19 16:33:42.126: INFO//system/bin/btld(256): # USerial_Ioctl: BT_Sleep, 0x8004 04-19 16:33:42.724: INFO//system/bin/btld(256): # USerial_Ioctl: BT_Wake, 0x8003 04-19 16:33:42.824: INFO/BTL-IFS(260): send_ctrl_msg: [BTL_IFS CTRL] send BTLIF_DTUN_SIGNAL_EVT (CTRL) 11 pbytes (hdl 14) 04-19 16:33:42.824: DEBUG/DTUN_HCID_BZ4(293): dtun_dm_sig_link_down() 04-19 16:33:42.824: INFO/DTUN_HCID_BZ4(293): dtun_dm_sig_link_down device = 0xf4f8 handle = 260 reason = 22 04-19 16:33:42.824: ERROR/BluetoothEventLoop.cpp(92): pollData[0] is revented, check next one 04-19 16:33:42.824: ERROR/BluetoothEventLoop.cpp(92): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/293/ hci0/dev_00_23_4D_F3_3B_BE 04-19 16:33:42.824: DEBUG/BluetoothA2dpService(92): Received intent Intent { act=android.bluetooth.device.action.ACL_DISCONNECTED (has extras) } 04-19 16:33:43.334: INFO//system/bin/btld(256): # USerial_Ioctl: BT_Sleep, 0x8004 04-19 16:33:46.334: DEBUG/CachedBluetoothDevice(168): updating profiles for APOLLO-4 04-19 16:33:46.344: ERROR/CachedBluetoothDevice(168): onUuidChanged: Time since last connect866040 04-19 16:33:46.344: DEBUG/BluetoothService(92): Cleaning up failed UUID channel lookup: 00:23:4D:F3:3B:BE 1101--1000-8000-00805f9b34fb 04-19 16:33:46.354: ERROR/BluetoothSppService(805): BT Connection exception java.io.IOException: Service discovery failed at android.bluetooth.BluetoothSocket $SdpHelper.doSdp(BluetoothSocket.java:377) at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:201) at com.sozonoff.android.bluetooth.BluetoothSppService $ConnectThread.run(BluetoothSppService
[android-developers] Re: Bluetooth stack becomes dead
Hi, Well for the moment its even worse on the HTC Desire, I cant even connect to using the SPP profile!!! I need to spend a little more time to gather more info but its not looking good :-( My understanding is that the Desire sports the same hardware as the Nexus 1 I would have thought Bluetooth was thoroughly tested on the Nexus 1. Regards, Serge On Apr 13, 11:43 pm, Rafał Grzybowski wrote: > Serge, > > Thank you for the reply. I'd be glad to hear how it works on HTC > Desire. > Maybe I'll try to switch to nativeBluetoothcustom library. > > Best regards > > On 13 Kwi, 16:50, ssozonoff wrote: > > > > > Hello Rafal, > > > I have this exact problem with my HTC Legend as well. I wrote a post > > here but it never appeared?? > > So far I have not been able to solve the issue and I don't know if its > > specific to the Legend. > > In a few days I receive my HTC Desire and will test with that. > > > If you close theBluetoothsocket while your are not stuck in the > > blocking read thestackshould be OK. Its only when closing the socket > > when blocked in the read that thestackgets corrupted. Sadly the only > > way to break out of the blocking read is to close the socket! > > > Please keep me posted if you find anything. > > > Thanks, > > Serge > > > On Apr 13, 1:05 pm, Rafa³ Grzybowski wrote: > > > > AfterBluetoothconnection is lost.Bluetoothstackon HTC Legend is > > > messed up. Nothing works tillBluetoothis turned off and on. Here is > > > the sample, the problem is blocking read on the thread but > > > InputStream.available call always returns 0 and cannot be used to > > > implement some ugly, busy-waiting workaround. > > > > package com.example.android.disconnectproblem; > > > > import java.io.IOException; > > > import java.io.InputStream; > > > import java.io.InvalidObjectException; > > > import java.io.OutputStream; > > > import java.util.UUID; > > > > import android.app.Activity; > > > import android.bluetooth.BluetoothAdapter; > > > import android.bluetooth.BluetoothDevice; > > > import android.bluetooth.BluetoothSocket; > > > import android.os.Bundle; > > > import android.os.Handler; > > > import android.os.Message; > > > import android.util.Log; > > > import android.view.View; > > > import android.view.View.OnClickListener; > > > import android.widget.ArrayAdapter; > > > import android.widget.Button; > > > import android.widget.ListView; > > > > public class MainActivity extends Activity { > > > private ArrayAdapter messages = null; > > > private BluetoothAdapter adapter = null; > > > private BluetoothDevice device = null; > > > private BluetoothSocket socket = null; > > > private ConnectedThread thread = null; > > > > /** Called when the activity is first created. */ > > > @Override > > > public void onCreate(Bundle savedInstanceState) { > > > try { > > > super.onCreate(savedInstanceState); > > > super.setContentView(R.layout.main); > > > } > > > catch (Throwable throwable) { > > > } > > > } > > > > @Override > > > public void onStart () { > > > try > > > { > > > super.onStart(); > > > > // setup click handler > > > Button btnConnect = (Button) > > > super.findViewById(R.id.btnConnect); > > > btnConnect.setOnClickListener(new OnClickListener() { > > > public void onClick(View v) { > > > try { > > > MainActivity.this.doConnect(); > > > } > > > catch (Throwable throwable) { > > > > > > MainActivity.this.handleThrowable("doConnect > > > failed", throwable); > > > } > > > } > > > }); > > > > Button btnDisconnect = (Button) > > > super.findViewById(R.id.btnDisconnect); > > > btnDisconnect.setOnClickListener(new OnClickListener() { > > > public void onClick(View v) { > > > try { > > > MainActivi
[android-developers] Re: Return value for a PendingIntent launched via a Notification
Hello Mark, Yes thanks, this is what I ended up doing in the end. Serge On Apr 16, 9:51 pm, Mark Murphy wrote: > ssozonoff wrote: > > Hello, > > > Is is possible to get back a result intent when launching an Intent > > from a Notification? > > > Similar to the way startActivityForResult() works ? > > Not directly -- there is nothing to receive the "result intent". > > Whatever the user launches from the Notification, though, can arrange to > broadcast Intents or something to achieve a similar effect. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android 2.x Programming Books:http://commonsware.com/books > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Return value for a PendingIntent launched via a Notification
Hello, Is is possible to get back a result intent when launching an Intent from a Notification? Similar to the way startActivityForResult() works ? Thanks, Serge -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Bluetooth stack becomes dead
Hello Rafal, I have this exact problem with my HTC Legend as well. I wrote a post here but it never appeared?? So far I have not been able to solve the issue and I don't know if its specific to the Legend. In a few days I receive my HTC Desire and will test with that. If you close the Bluetooth socket while your are not stuck in the blocking read the stack should be OK. Its only when closing the socket when blocked in the read that the stack gets corrupted. Sadly the only way to break out of the blocking read is to close the socket! Please keep me posted if you find anything. Thanks, Serge On Apr 13, 1:05 pm, Rafał Grzybowski wrote: > After Bluetooth connection is lost. Bluetooth stack on HTC Legend is > messed up. Nothing works till Bluetooth is turned off and on. Here is > the sample, the problem is blocking read on the thread but > InputStream.available call always returns 0 and cannot be used to > implement some ugly, busy-waiting workaround. > > package com.example.android.disconnectproblem; > > import java.io.IOException; > import java.io.InputStream; > import java.io.InvalidObjectException; > import java.io.OutputStream; > import java.util.UUID; > > import android.app.Activity; > import android.bluetooth.BluetoothAdapter; > import android.bluetooth.BluetoothDevice; > import android.bluetooth.BluetoothSocket; > import android.os.Bundle; > import android.os.Handler; > import android.os.Message; > import android.util.Log; > import android.view.View; > import android.view.View.OnClickListener; > import android.widget.ArrayAdapter; > import android.widget.Button; > import android.widget.ListView; > > public class MainActivity extends Activity { > private ArrayAdapter messages = null; > private BluetoothAdapter adapter = null; > private BluetoothDevice device = null; > private BluetoothSocket socket = null; > private ConnectedThread thread = null; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > try { > super.onCreate(savedInstanceState); > super.setContentView(R.layout.main); > } > catch (Throwable throwable) { > } > } > > @Override > public void onStart () { > try > { > super.onStart(); > > // setup click handler > Button btnConnect = (Button) > super.findViewById(R.id.btnConnect); > btnConnect.setOnClickListener(new OnClickListener() { > public void onClick(View v) { > try { > MainActivity.this.doConnect(); > } > catch (Throwable throwable) { > MainActivity.this.handleThrowable("doConnect > failed", throwable); > } > } > }); > > Button btnDisconnect = (Button) > super.findViewById(R.id.btnDisconnect); > btnDisconnect.setOnClickListener(new OnClickListener() { > public void onClick(View v) { > try { > MainActivity.this.doDisconnect(); > } > catch (Throwable throwable) { > > MainActivity.this.handleThrowable("doDisconnect > failed", throwable); > } > } > }); > > // setup messages > this.messages = new ArrayAdapter(this, > R.layout.message); > > ((ListView)super.findViewById(R.id.lstMessages)).setAdapter(this.messages); > } > catch (Throwable throwable) { > this.handleThrowable("onStart failed", throwable); > } > } > > private void doConnect () throws Throwable{ > if (this.adapter == null) { > this.adapter = BluetoothAdapter.getDefaultAdapter(); > this.addMessage("adapter retrieved"); > } > > if (this.device == null) { > this.device = adapter.getRemoteDevice("00:18:9A:01:3E:7E"); > this.addMessage("device retrieved"); > } > > if (this.socket != null) { > throw new InvalidObjectException("Socket already retrieved"); > } > else { > this.socket = > device.createRfcommSocketToServiceRecord(UUID.fromString("1101--100 > 0-8000-00805F9B34FB")); > this.addMessage("socket retrieved"); > } > > socket.connect(); > this.addMessage("connected"); > > this.thread = new ConnectedThread(this.socket); > this.thread.start(); > /* > InputStream input = socket.getInputStream(); > this.addMessage("input stream opened"); > > OutputStream output = socket.getOutputStream(); > this.add
[android-developers] SPP Bluetooth and interrupting a blocking read operation
Hello All, I am currently developing an application using RfComm in Bluetooth and have everything working except for the following. I am wrapping the InputStream I obtain from the Bluetooth socket in a BufferedReader and calling readLine() which blocks if there is no data. So far I have found no way of interrupting the readLine in a way which leaves the Bluetooth stack in a working state. Closing the underlying socket will interrupt the readLine() but following this the Bluetooth adapter is not usable anymore until I stop and start Bluetooth on the phone. This is possibly and bug. Anyone have any ideas? Thanks, Serge -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using "remove me" as the subject.