Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>AFAIK, it would appear that this thread continues to execute.</p> </blockquote> <p>This is true but you have no guarantee of how long the thread will stay alive.</p> <blockquote> <p>What will happen to this thread if the Android gets into a low memory situation and decides to kill the entire Application?</p> </blockquote> <p>This is actually a fairly rare case in my experience but it will depend on the device's available memory and the user's behaviour, for example they use the device heavily and start multiple apps.</p> <blockquote> <p>Will there ever be a situation were this thread might die prematurely?</p> </blockquote> <p>Yes</p> <blockquote> <p>If so, is there any way I can see that the thread is being killed, and do something about it?</p> </blockquote> <p>No</p> <blockquote> <p>I'm asking because this thread modifies important data in the database, and if it is suddenly killed, the application could stop functioning properly.</p> </blockquote> <p>What you describe could be classed as something which is 'mission critical'. As the other two answers have pointed out, a Service would be a more robust way of doing things as a Service is one of the last things to be 'killed' in a low memory situation. Using START_REDELIVER_INTENT may help in resuming what it was doing.</p> <p>In any case, if you have a 'mission critical' operation, you need to design your code for full recovery such as the use of transactions and the possibility of rollbacks in case of errors.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload