You can use Android's adb tool:
adb shell uiautomator events
Make sure you have USB Debugging enabled on your device. Connect your device to a computer and open a terminal to run the above adb command.
Running this command will dump out system events - you will get a LOT of information.
For example, here's a Toast I created by setting an alarm with the Clock app:
11-27 16:31:32.510 EventType: TYPE_ANNOUNCEMENT; EventTime: 6865213;
PackageName: com.google.android.deskclock; MovementGranularity: 0;
Action: 0 [ ClassName: android.view.ViewGroup; Text: [Alarm set for 15
hours and 59 minutes from now.]; ContentDescription: null; ItemCount:
-1; CurrentItemIndex: -1; IsEnabled: true; IsPassword: false; IsChecked: false; IsFullScreen: false; Scrollable: false; BeforeText:
null; FromIndex: -1; ToIndex: -1; ScrollX: -1; ScrollY: -1;
MaxScrollX: -1; MaxScrollY: -1; AddedCount: -1; RemovedCount: -1;
ParcelableData: null ]; recordCount: 0
Note the app in question is listed under PackageName
as com.google.android.deskclock;
. This should give you a good idea which app the Toast has originated from.
TOAST_WINDOW
like this: android.stackexchange.com/a/215658/218526