Example: User can write an article and when the user wants to submit it (send to server) how should the app handle that? Should it just show a progress dialog and while the dialog is shown restrict user from doing anything else in the app? Or should the app let the user continue and handle it in background? What should the app do if the background task fails (connection timeout or article does not meet requirements for example)? Show a toast? And should it also show a toast on success? Are there any other solutions for this? Also if the task runs in background and user requests list of published articles and the submitted article is not there because it wasn't sent to server yet the user will be probably confused?
I feel you need to refer the UX.stackexchange.com, after submitting the comments, it shows process icon with message.
For submission of article, showing the progress/process icon would be better.
Showing as background save would not fit here. Background task best fits in File sync, download and etc.
You should put it in the background. When it fails, pop up a notification and/or a black bar that says something like "Publishing failed. Retrying...". And also, if the user requests the list, and the app knows it's still uploading, it just should add a little mark, that says "In progress...".
I like HKYL's suggestion, but I would add that even if something is happening in the background, you should indicate that it is happening to the user, no matter what the conditions are.
For some users, having no indication of any progress can create anxiety and uncertainty about how the system is working and if their work is going to be retained. We can avoid that anxiety by adding a small indication somewhere that says "Saving" or "Submitting". This would likely be the same place you would use to indicate that it has been successfully saved.
Check out how google docs does this as an example (grey text on the far right):
Another option would be to put a loading spinner in the button the user used to submit it. Here is an example: