简体   繁体   中英

How to prevent Bluetooth Connection Lost when the user backs out of the application?

i have no idea how to let the RFCOMM connection keep connecting to a serial device even though the user backs out of the application. I've searched the internet but still not answering my question. So do anyone knows? Any answer is a great help.. Thanks.

In general you shouldn't. When the user backs out of your application the system will close your activities and you should close your connections, etc. After all, there is a good chance your app will get killed after this.

If you really need to keep your connections alive after user backs out then you will need to implement your connections in a service. The service has more control over its life-cycle then an app, and is independent of the activities life-cycles, so the service can continue operating even after the user has closed your activities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM