S
S
StynuBlizz2017-04-21 03:57:14
Android
StynuBlizz, 2017-04-21 03:57:14

How to perform an action in android after closing the fragment in which this action was launched?

The problem is, there is a fragment in which the user can change the data, and when the change button is pressed in this fragment, a request is sent to the server, after executing the logic, the server sends in the response whether there were changes or not, and if the changes were made, then in the application I I write new data to shared preferences. But what if the user at the time of the request (before the server response was received) turns off the phone, or simply presses the back button and closes the fragment? After all, I will not have time to save the data, and changes will be made on the server, and the user will not even know about it.
I can’t use services for this situation, since I will need to execute the logic inside the fragment after the request is executed (but if the fragment was closed and the application crashes, it doesn’t matter, the main thing is that I have time to save the new data)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question