Not getting notifications until restarting app

I am running companion app on Android 9, Phone is a DOOGEE S95Pro.

The app appears to stop running (the phone is not restarted) and as a result I am often not getting notifications until I access the app manually (by clicking on the app to start/restart it).

Battery optimization is switched off for the app. It happens both when I am on my WiFi or using mobile data.

Other symptoms include the app not updating sensors such as location or battery level until the app is selected.

Make sure the app has access to run in the background too, not much we can do if your system devices to constantly kill it.

Yes it has permission to run in background, just double checked and in that version of Android that is done by turning off battery optimization.

and the app configuration screen says the app has permission to run int eh background? you may need to dig deeper on your device for other manufacturer settings as well.

I have looked everywhere and been on Android forums, which gives advice about background running which I have followed and it is an unmodified Android version. Is there a way to check if it is a crash or it has been shut down?

logcat on the device will tell you if it crashed, you still didnt look at my suggestion…go to app configuration and check the background tile and see if it says its been granted or not

After trying various things over the weekend and testing them (It takes time to make sure it is not going to sleep), I think I found a fix, akin to turning it of and on again. I followed the process, before I start however just to confirm it was definitely already set to have permissions to run in background:

Switch to optimized in battery settings (meaning it should go to sleep)
Reboot phone
Switch to not optimized in battery settings (meaning it is back where it said it was)

Now things seem to work as expected with notifications etc coming through consistently. I will keep monitoring over a few days to confirm.