What options do I have to save my data when onPause is called so that I can be sure that the data has been saved?
Technically, what you want is impossible. After onPause() there are no guarantees.
The best answer is what @Viktor Lannér suggested. To express this in another way, do not wait for onPause() take 10-20 seconds of I / O. Come up with some kind of mechanism that allows you to save in stages, since the user performs operations as a backup mechanism, if nothing else. This is similar to how a transaction log is stored in a database.
Starting a new thread in onPause and saving data there. This seems to work fine, but it seems like I shouldn't do it.
This is dangerous because if the action closes (for example, onDestroy() will be called instantly), Android may terminate your process before the thread completes.
Starting the service, somehow copying the data to the service (will it be slower?), And then getting the service to save the data. I think this puts a notification icon at the top of the phone, but I don’t think it is terrible for the user to see the “Save Data ...” task here.
Make it an IntentService , so it will automatically shut down when work is completed. I would not “copy the data to the service”, but rather make the data centrally accessible by the static data member, if necessary. This will not automatically put a “notification icon at the top of the phone,” and for some such time it probably won't be needed.
Is it possible to quickly put data into an SQL database and then save it later when the user returns to the application?
Flash I / O is not faster for an SQL database than for anything else.
Due to the nature of the application, there really is no practical way to save data during operation, because the user can transform the data in destructive ways using laborious operations (for example, 10 seconds for some operations
Then it is probably not intended for a mobile platform. Think about whether this application is suitable for using technology.