Ahmed Mostfa Ahmed Mostfa - 4 months ago 7x
Android Question

How to make my android app(has bluetooth connection) works without loosing connection when I press home button

am a beginner in Android, and need to know how can I make my app that has bluetooth connection with a hardware device, not to lose the connection when I press the home button or the app is still running the service while am doing smthg else in my device. hope I could reach my point.


When Home Button is Pressed OnPause() method is called .

So Add this method just outside onCreate ()

And Do Whatever You Want To Do .

Like Call

onPause(){ //Take this with ctrl+space

// Call onresume method here , this may work .

onResume() // take with ctrl+space


protected void onPause() {