Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

退出app后就会断开连接,不知道哪里出了问题 #558

Open
jxxp opened this issue Sep 30, 2022 · 1 comment
Open

退出app后就会断开连接,不知道哪里出了问题 #558

jxxp opened this issue Sep 30, 2022 · 1 comment

Comments

@jxxp
Copy link

jxxp commented Sep 30, 2022

没有调用, BleManager.getInstance().disconnectAllDevice();BleManager.getInstance().destroy();
断开连接的任务方法。

@Override
protected void onDestroy() {
    super.onDestroy();

// BleManager.getInstance().disconnectAllDevice();
// BleManager.getInstance().destroy();
Log.d("MainActivity", "onDestroy");
}

@Wheats
Copy link

Wheats commented Oct 17, 2022

断开连接

1.如果没有主动断开连接,想保活。试试把连接放在服务里,用startForegroundService 和Notification搭配使用。

2.如果连接上,一直有数据交互,切换后台不会断开,不会杀死。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants