I've noticed that one of my apps is experiencing a lot of crashes on Android 8.x devices lately. Looking at the crash reports I narrowed down the cause of the crash to a reference to a variable declared in the Starter service - however the OS appears to be stopping the service when the app is in the background.
I thought I could get around it by adding this code right at the start of my Activity_Create sub:
If IsPaused(Starter) Then StartService(Starter)
My thought was that if the app had been in the background & Starter was stopped, this would get Starter running again before I referenced the variable in it (later in Activity_Create) - but I am still seeing a lot of crashes, so I don't think this is working. Or is it that Starter is taking longer to start than it takes for my code to get to the line that references the variable?
So - any ideas on how to make sure Starter is alive when Activity_Create is called? This is a hard one to test because I'm not sure if there's a way to force Android to stop the Starter service.
- Colin.