Handling Toast messages on Android

I’m currently working on a TestSetup for Android/iOS via Robotframework+Appium. I have ~30 Tests running on a nightly base. In these Tests the App will eventually produce Notifications on certain events. After all that’s the point of the test to create this states.
Anyway with these notifications come “Toast messages” which will overlay the screen for a certain time. These breaks Test in unexpected ways as the Toast may overlay elements i wanted to click in this very moment. I reverted to more defensive strategy and checking if this element is available and then clicking, but since this is not an “atomic” operation it still happens that a toast appears in between leading to errors and flaky tests which have to be reviewed daily.

As far as I can see there is no possibilty to deactivate toast messages on Anroid.

An idea would be to leverage the “Register Keyword To Run On Failure” semantic in Appium. and then detect if a toast message was present if so mark the test for repeat or repeat the failing keyword after a delay. Has anyone done this? Or any other approach which I’m not aware of?

I would try, Run Keyword And Return Status combined with “Wait Until Toaster Is Not Present”. This keyword would have some way to identify the presence of Toast. Also Run Keyword And Ignore Error can be used for these cases.