On Fri, Mar 18, 2011 at 10:48 AM, Robert <[email protected]> wrote:
>  My application connects to multiple bluetooth devices. I want to stop the
> connection whenever the user leaves the app, including when they press the
> HOME button. However I have no way of detecting when HOME is pressed, which
> will keep the bluetooth connection running, thus continuing to drain the
> battery of the phone. All of the examples I've found, including the ones in
> the Android Developer site, do not take care of disconnecting when leaving
> the app.
>
> I can check to see if the user completely backs out of the application using
> the BACK button, but not the HOME. Is there a way that I can accomplish this
> without having to wait for the phone to decide it needs more memory and then
> destroy the activity?

You could disconnect in onPause().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
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

Reply via email to