Imagine the follow situation:
MainActivity starts a thread to receive bluetooth data.
If the user press back button the follow sequence happens: onPause() -> onStop() -> onDestroy()
. The onDestroy interrupts the thead created by activity and the program finish completely.
But, if the user press home button the sequence is : onPause() -> onStop()
. and the activity is no longer visible. But the thread still running.
What i want to do is , when some BT data is received by by the thread, the MainActivity becomes visible again (resume) without user intervention.
Anyone know how to do it?
Thanks.