Background:
I am making an app that runs in Kiosk Mode (enabled by making the app the Device Owner). The app is just for me, and it will not be available on Google Play.
Problem:
When I turn on Kiosk Mode it says "Screen Pinned" and "Kiosk Mode enabled" in a dialog, each lasting 3 seconds. When I turn off Kiosk Mode it says "Screen Unpinned" and "Kiosk Mode disabled" also in dialogs lasting 3 seconds each. When the app needs to toggle the Kiosk Mode multiple times in a row, all of the dialogs will still show. So if it is toggled 5 times, then there will be 30 seconds of dialogs (2 messages * 3 seconds * 5 times = 30 seconds). How can I turn these dialogs off?
Extra info:
The reason the app needs to toggle the Kiosk Mode is because when it is first opened, it asks the user permission to access the USB device. Android will not show this request when the screen is pinned, and it will not remember that I granted the permissions the next time the tablet is restarted (even though I check the box that asks if I want it to remember). Therefore the Kiosk mode has to be temporarily disabled for this dialog.
I tried turning off all notifications in the app settings. This did get rid of the "Kiosk Mode enabled/disabled" dialogs (not the "Sceen Pinned/Unpinned'), but it also got rid of the dialogs that I made for the app. So that will not work.