Toast messages not getting captured on time

I am testing a native android app where one of the scenario is clicking a button and making sure we get the appropriate toast message. Our android app is connecting to firmware devices using bluetooth. The code we use to capture the toast messages is as follows:

public void waitFor() {
		try {
			FluentWait<WebDriver> wait = new FluentWait<WebDriver>(getDriver())
			WebElement toastView = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(("//android.widget.Toast[1]"))));
			text = toastView.getAttribute("name");
			if (toastView != null && text != null && !text.isEmpty())
				wasObserved = true;
		catch (Exception e)
			wasObserved = false;

Problem is - since our app is busy doing multiple things like detecting devices, it is unable to detect the toast message on time, i.e. the time between clicking on the button and detecting the toast message (where is appears for a short period of time and disappears as is its normal intended behaviour) is some how too large and the toast message disappears and test fails. I wanted to check if anyone has a solution to this problem since too many of our tests rely on toast message checks and there is no other way to get the same message, i.e. through application logs etc.

Why not just open notifications and check message there?

Unfortunately my app doesn’t produce any notifications.

Only with Espresso we can catch reliable toasts.