2

I am implementing an app, that has to do some heavy sensor(even with location) data collection while user does some activity.

To do this, when user clicks the start collection, I create a foreground service to ensure continuous collection of the data. It works fine on most devices, but on Huawei P20 if I close the screen at some point (could be 5 minutes, could be less, or more) it kills the app and foreground service. This does not seem to be cased when the device is in a charger.

I know a foreground service could be killed if the device needs memory etc., but during my tests the device was only running my app, so there should not have been a need to kill the application.

Any advice would be appreciated.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Viktor
  • 521
  • 1
  • 4
  • 17
  • It just what Huawei always does. They also kills background apps which is not famous or major. – wonsuc Jun 01 '18 at 13:39

1 Answers1

3

Well I asked Huwei support. You can manually keep the app running by setting the app (and google play service too) to be managed manually rather then automatically. I have asked for an Intent, that could make this more reasonable for users, but the answer was "the phone os was not designed for this"...

Viktor
  • 521
  • 1
  • 4
  • 17
  • 5
    "The phone OS was designed to not allow apps to work the way they should and to make users believe the app is broken." :( – Patrick Boos Jun 25 '18 at 22:56