5

So, I seen answers to this question in Stackoverflow, but I don't found final answer. So, I've following a problem: I've separated Thread to Socket. And I create and start this thread on Application onCreate method. And I need intercept this thread when application killed from recent apps list. If user press back button system will call to onDestroy, and this situation I can intercept socket thread. But, I can't intercept socket thread when user kill app from recent apps list.

Anybody have final answer how to solve this problem?

SBotirov
  • 13,872
  • 7
  • 59
  • 81
  • I need listen socket in background, if app not destroyed – SBotirov Nov 06 '14 at 04:38
  • Wait..if i remembered correctly, thread will automatically destroyed when the activity is destroyed..means your thread will be stop if the user kill from recent app list – Blaze Tama Nov 06 '14 at 04:59
  • Really? if app is killed from recent apps list and socket thread intercept, too? – SBotirov Nov 06 '14 at 05:18
  • As far as i know, it is why Google create a Service class. Async and Thread destroyed when the activity is destroyed, Service is not. – Blaze Tama Nov 06 '14 at 05:19
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64366/discussion-between-mr-boyfox-and-blaze-tama). – SBotirov Nov 06 '14 at 05:36
  • ok, system destroy and recreate service if memory is low, what do you mean about this? – SBotirov Nov 06 '14 at 06:39

0 Answers0