0

I am dealing with problem that my application crashes if it is in background and my stack trace says that the problem is with startService() function. Android documentation for developers states in the section Migration, in the first bullet point, the following:

If your app needs to create a foreground service while the app is in the background, use the startForegroundService() method instead of startService().

My crashlytics says that the application was in 97% cases in background. Also, the operating system of the users is either Android 8 or Android 9. So I am convinced that the problem can be solved by following the instructions provided on the webpage above.

However, my problem is that I can not find any definition of "app in background" state on the webpage for android developers. I just suppose that "app is in background" means that you do not directly see the applications UI on the screen in the certain moment. Moreover, I can not reproduce the problem on my own in the virtual devices. While trying to reproduce the problem, I suppose that "app is in background" means what I have just described.

Is it possible that virtual devices do not behave the same way as the physical ones? Or is there problem with my understanding of app being in background?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
scarface
  • 574
  • 6
  • 20

0 Answers0