I have a Bluetooth implementation in my app that goes through its entire set-up and tear-down in onResume and onPause in my main activity. The application communicates with a Bluetooth serial adapter. The trouble is that sometimes the user needs to leave our main activity for some other activity within my app. Or he may briefly go to some other app. In either case, upon returning to my main activity, the entire Bluetooth set-up is repeated. This can take up to 5 seconds to re-establish the link. I would like to make some of the set-up static so that it lasts as long as my app's process is running. Of course if my app is killed, I will have to start over. I accept that. But if my main activity has been merely put into background, it would be nice if the user could return to that activity and not have to wait up to 5 seconds for the Bluetooth connection to be re-established. What is the best practice for maintaining a Bluetooth connection in this case? In other words, which parts of the Bluetooth set-up can I do just once and which parts need to be re-done whenever the main activity that created it is resumed?
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

