Using ResultReceiver, what happens if the action is destroyed and the intent service is still running

this question has already been asked here , but there is no good answer yet

so basically I have an intention service running in the background to do something, and once done, I will return the result back to activity using resultreceiver, so I need to know the following

  • how to cope with a situation where the action is destroyed when the service is still running?
  • How do I know if activity from the intent service is destroyed?
  • what happens to resultreciever when sending a result back to an activity when the activity is already destroyed? Did this cause an error?
+4
source share
1

, IntentService, .

, , ?

IntentService , , , , . , IntentService, . , ? , . , stopService(Intent), onDestroy() IntentService, , .

, ?

, . - IntentService, ResultReceiver

resultreciever , ? ?

- , . , , ( - , , . IntentService ). , , , ResultReceiver onDestroy, .

, , LocalBroadcastManager, Activity / BroadcastReceiver. Google

+2

Source: https://habr.com/ru/post/1649623/


All Articles