Pop up windows while running Android APP Appium, Test

Good Morning. I have been developing automation on Appium Android for the 4 years and I have a problem that I would love to receive advice from you on how to overcome it.

I use live devices that are connected to a computer and run automation tests on an app that my company has developed. The app has many windows and the running time of the automation is long, about 8 hours. The problem starts when while running the Test a pop up windows jump and destroying the test and it fails. There are many types of pop-ups, version upgrade, advertisement, app rating and moreā€¦ Since I do not know in advance when the pop-up will jump I can not expect it and close it. And as soon as a pop-up pops up and goes on the app that is currently cracking the automatically and of course the test fails

what can we do ??

Thanks for answering!

Ask developers to add a backdoor, which disables popups, and use this backdoor while running your automated tests. The backdoor could also be only enabled for dev app flavour and disabled for prod to make sure nobody else could consume it unattended.

I will start from configuring phones and disable all possible types of interactions like: Disable updates. Also you can try kill some services by package name before test. Disable all possible synchronization of accounts installed on phone.

PS what are you running for 8h? some repeating tests?

I apologize for the late response. I will try what you wrote and yes. I test phone calls between several devices that last for several hours.
Thanks for the comment!

I probably did not explain myself, I mean pop-ups that come from other apps or from the system itself.
Anyway thanks for the comment!