M
M
magary42015-08-19 10:51:58
Android
magary4, 2015-08-19 10:51:58

Is it possible to prevent Android OS from killing activities when out of memory?

The application uses Cordova
Is it possible to prevent the Android OS from killing activities when there is not enough memory?
If not, which implementation path is better to go, write the Android Service yourself, or use the cordova plugin.
Here I found two:
- https://github.com/katzer/cordova-plugin-backgroun...
- https://github .com/MobileChromeApps/cordova-plugin...
as I understand it, the 1st plugin allows you to execute a js function when the activity itself is stopped, how is this possible?
The second one, as I understand it, sends it to the background immediately at the start of the application.

it allows starting an app as an Android service, but does so without the use of an actual service
then how does it do it?
is it possible to make the application active from the background service for a specific case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robert, 2015-08-19
@NgNl

Is it possible to prevent Android OS from killing activities when out of memory?
It is forbidden.
-If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused. A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations.
-If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.
-If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process. When it is displayed again to the user, it must be completely restarted and restored to its previous state.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question