Created
May 13, 2023 13:50
-
-
Save prongbang/bf9d3dff135ed300b87a2322cb032023 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void disableScreenRecording({bool enabled = false}) async { | |
// Get the Android device. | |
final device = await FlutterDevice.current; | |
// Run the "adb shell settings put secure allow_screen_captures" command. | |
final result = await device.run('adb', [ | |
'shell', | |
'settings', | |
'put', | |
'secure', | |
'allow_screen_captures', | |
enabled ? '1' : '0', | |
]); | |
// Check the result. | |
if (result.exitCode != 0) { | |
throw Exception('Failed to disable screen recording.'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment