Как гарантировать, что моя служба переднего плана будет работать как можно дольше?Android

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Как гарантировать, что моя служба переднего плана будет работать как можно дольше?

Сообщение Anonymous »


I am developing a mobile app on Android that will track the hours that users spend in certain location using geofencing technology. This app will be installed on phone that will be provided by companies to their employees and this app is one of (if not the most) important app on the phone.

The built in Geofencing API provided by Android is not sufficient in my case so I have to use my own implementation. I have made a foreground service that is asking the location of the user periodically and check if they are inside given geofence or not.

The problem is that the system is killing the process after around 2 days of working, while I need to have it on for as long as possible. I know this should be possible as I've seen some examples like Kaspersky antivirus, which is working 24/7-365.

I would like to know a few things.
  • How to extend the lifetime of the foreground service as much as possible?
  • What are the factors that affect how quick the system will kill given foreground service?
  • How can I test properly how long the service will be working?

I have read the whole documentation about services and foreground services specifically that is provided by Android as well as just browsing other threads here, but I didn't found anything that will help me to extend the lifetime of the foreground service more. I know that it makes it even more complicated that it is manufacturer dependent. In the previous versions of the app, we have used Knox and it was working to some extent, but we decided that this decision had more negatives than positives.

The battery optimization is also turned off, but it seems like not helping too much.


Источник: https://stackoverflow.com/questions/780 ... s-possible
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»