How to continue operations after the completion of the application?

0 like 0 dislike
2 views
In General, there is an operation (the usual rx.Observable), the result of which I need to notify the user. Operation I is stored in a separate GPO linked to instau application (or rather is a Singletone from Dagger)

If you have opened a certain activity she subscribes to the observable and the result changes the UI.
If not - I make a message using the NotificationManager.

But if the user closes the app - nothing happens. How to make the operation continued even if the app is closed - I can show the Notification?

I understand that here it is necessary to use Service, well then another question arises: the operation can change the state of other singletone objects (as in dagger) - and if you do Service, then I need to Application and Service these singletons were one and the same topic instances. Is it real?
by | 2 views

2 Answers

0 like 0 dislike
Service can extend the life of the application, but no guarantees there. In addition, there is a Doze mode, and everything is generally bad. But you can try. On the topic of singletons in dagger - well, the service lives within the same application, what's the problem?
by
0 like 0 dislike
How would the system decide who to kill and who to live. And when. (Usually depends on resources)
The longest-lived foreground processes. Those that are in the foreground. (for example in the process of running activiti with which the user interacts).
If resources are not enough, you kill them last.
Least of all Empty Processes - they have no active components. However, they can not kill (save for caching) .

it is possible to improve your process to the foreground level through service and startForegroud.
https://medium.com/google-developers/who-lives-and...
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Mar 25, 2019 by trilodi
110,608 questions
257,186 answers
0 comments
33,945 users