motorola

How to prevent Android bluetooth RFCOMM connection from dying immediately after .connect()?

北城余情 提交于 2019-11-26 12:42:35
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're the heroes! :) This is the working code. It connects to Zeemote and reads data from it. ===== Code ===== public class ZeeTest extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { for (int i = 0; i < 3; i++) { test(); } } catch (Exception e) { e.printStackTrace(); } } private boolean connected = false; private BluetoothSocket sock; private InputStream in; public void test() throws Exception { if (connected) { return; }

How to prevent Android bluetooth RFCOMM connection from dying immediately after .connect()?

三世轮回 提交于 2019-11-26 03:05:29
问题 This problem has been solved! Thanks a lot to Brad, Denis and junkie! You\'re the heroes! :) This is the working code. It connects to Zeemote and reads data from it. ===== Code ===== public class ZeeTest extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { for (int i = 0; i < 3; i++) { test(); } } catch (Exception e) { e.printStackTrace(); } } private boolean connected = false; private