@magary4

Можно ли запретить ОС Anroid убивать активити при нехватке памяти?

Приложение использует Cordova
Можно ли запретить ОС Anroid убивать активити при нехватке памяти?
Если нет, то по какому пути реализации лучше пойти, Android Service написать самому, или применить плагин cordova
Вот я нашел два:
-https://github.com/katzer/cordova-plugin-backgroun...
-https://github.com/MobileChromeApps/cordova-plugin...

как я понимаю 1й плагин позволяет выполнять js-функцию когда сам activity остановлен, как это возможно?
второй как я понимаю сразу при старте активити приложения отправляет в фон.
it allows starting an app as an Android service, but does so without the use of an actual service
тогда как оно это делает?

можно ли при конкретном кейсе из бекграунд сервайса сделать приложение активным?
  • Вопрос задан
  • 521 просмотр
Пригласить эксперта
Ответы на вопрос 1
@NgNl
Jira dev
Можно ли запретить ОС Anroid убивать активити при нехватке памяти?

Нельзя.

-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.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы