I have an android application where want to update my remote database when the application is killed. Now I use onTaskRemoved() method of one of my Service where I handle when the application is removed from the current applications list and send Intent to BroadcastReceiver where call a request to my remote database (want to wait the response from the back-end if the write operation is success). This approach not works all the time.
The main idea is to know which users are in their applications and which killed it.