I'm using Native Screen Recording functionality provided by Android. When I start recording System popups Dialog and ask user to confirm that screen can be recorder. If user press outside dialog dismissed (same behaviour when he/she press cancel) when press Start Now Recording Start.
How I can detect what user pressed
How can I disable dismiss on press outside of dialog
Is there a way to avoid showing dialog?
How I can detect what user pressed
You can determine if the user pressed "Start Now" as part of your normal media projection flow. For example, when you pass the onActivityResult()
data to getMediaProjection()
, getMediaProjection()
will only give you a MediaProjection
object if the user pressed "Start Now".
You cannot distinguish between "Cancel", "click outside the dialog", pressing the BACK button, pressing Esc on a device with a physical keyboard, or any other means of dismissing this dialog.
How can I disable dismiss on press outside of dialog
The decision on how to handle this is up to the system, not you.
Is there a way to avoid showing dialog?
No.