Android 蓝牙首次运行后的不同行为
我花了一个下午阅读这里所有与蓝牙和安卓有关的帖子。有一些帖子与我长期存在的问题相关,即当我第一次打开它并使用蓝牙连接时,我的应用程序运行良好。
但是,当我退出应用程序并稍后重新输入时,蓝牙数据流崩溃。日志中没有任何解释,什么都没有。
我正在关闭蓝牙输入和输出流,关闭套接字,并且断开连接也在另一侧发生。
为什么应用程序在第二次或多次重新输入时表现不同?
我正在 Advent Vega 平板电脑上进行测试,
我在关闭套接字后尝试 Runtime.getRuntime().exit(0);
,然后调用完成。所有线程都会打印 run 方法的最后一行,所以我知道它们正在优雅地死亡。
I have spent the afternoon reading all the post on here to do with bluetooth and android. There have been a few posts related to my long standing problem which is my app runs fine when i first open it and use a bluetooth connection.
However, when i exit the app and re enter it a bit later the bluetooth data stream crashes. No explanation in the log, nothing.
I am closing the bluetooth input and output streams, closing the socket and the disconnection takes place on the other side also.
Why does the app behave differently when re entering it for a second time or more?
I am testing on an Advent Vega tablet,
I am trying Runtime.getRuntime().exit(0);
after closing socket, then calling finish. All threads print there very last line of the run method so i know they are dying gracefully.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论