3 ms·
Toast can only be displayed when the app is the foreground. If there is not single definition of what foreground is then how is someone supposed to know whethe
by ashishb 1y ago
Toast can only be displayed when the app is the foreground.
If there is not single definition of what foreground is then how is someone supposed to know whether a toast will be displayed or not?
- charcircuit 1y agoIf someone wants to know the real definition they need to read the AOSP code. The code is the source of truth and it could potentially change in a future versions if a new security concern came in. https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java;l=10104 https://cs.android.com/android/platform/superproject/main/+/... Whether a toast is successfully toasted is reported back to the app's process, but the android framework doesn't expose this result to the app which implies that one shouldn't need to rely on the toast being shown or not.
- ashishb 1y ago> which implies that one shouldn't need to rely on the toast being shown or not. I wanted to display Toast if I can, and if not, a developer might prefer to display a Snackbar or a notification if a Toast cannot be displayed.