You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/image/capturing-a-screenshot.md
+68-8Lines changed: 68 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,55 @@
1
1
---
2
2
title: Capturing a Screenshot
3
-
sidebar_label: Capturing a Screenshot
4
3
---
5
4
6
5
7
6
You can use this extension to capture a screenshot of your application as bitmap data and subsequently use that data as you require.
8
7
9
8
This is currently supported on iOS and Android API version 21 or higher.
10
9
11
-
To capture a screenshot you simply call `captureScreenshot` and await completion.
10
+
To capture a screenshot you simply call `captureScreenshot()` and await completion.
12
11
13
12
```actionscript
14
-
var success:Boolean = Image.service.captureScreenshot();
13
+
Image.service.captureScreenshot();
14
+
```
15
+
16
+
`captureScreenshot()` may return `false` if the current platform is not supported or if a screenshot capture is currently in progress. You should avoid wherever possible capturing two screenshot simulataneously as this may have undesirable results.
17
+
18
+
19
+
20
+
21
+
## Completion
22
+
23
+
You can either use a callback or events to handle the completion of the screenshot.
24
+
25
+
26
+
### Callback
27
+
28
+
You can pass a callback function to the `captureScreenshot()` method:
29
+
30
+
```actionscript
31
+
Image.service.captureScreenshot(
32
+
function ( bitmap:BitmapData ):void
33
+
{
34
+
if (bitmap != null)
35
+
{
36
+
// bitmap will contain the bitmap data of the screenshot
37
+
trace( "captureScreenshot: complete" );
38
+
}
39
+
else
40
+
{
41
+
trace( "captureScreenshot: an error occurred" );
42
+
}
43
+
}
44
+
);
15
45
```
16
46
17
-
`captureScreenshot` may return `false` if the current platform is not supported or if a screenshot capture is currently in progress. You should avoid wherever possible capturing two screenshot simulataneously as this may have undesirable results.
47
+
The callback function must be of the format: `function ( bitmap:BitmapData ):void`.
48
+
18
49
50
+
### Events
19
51
20
-
Completion is indicated by either a success event `ImageEvent.SCREENSHOT_COMPLETE` or an error `ImageEvent.SCREENSHOT_ERROR`.
52
+
You can listen for a success event `ImageEvent.SCREENSHOT_COMPLETE` or an error `ImageEvent.SCREENSHOT_ERROR`.
@@ -38,15 +70,43 @@ function screenshot_errorHandler( event:ImageEvent ):void
38
70
```
39
71
40
72
41
-
## iOS
73
+
74
+
## Platform Considerations
75
+
76
+
There are some differences between the platforms here.
77
+
78
+
79
+
### iOS
42
80
43
81
On iOS your screenshot will be captured without any user interaction. It is not possible to get the current image of the status bar so only your application accessible content will be contained in the screenshot.
44
82
45
83
46
-
## Android
84
+
### Android
85
+
86
+
Since Android 26 we now have a method to capture the screen without user interaction and this is now the default operation of the extension. This approach won't capture the status or navigation bar elements similar to iOS however the operation will be much more seamless.
87
+
88
+
89
+
If you wish to force the extension to use the older approach (with a media projection) you can pass `false` as the second parameter to the `captureScreenshot()` method, which will attempt to capture the full screen.
90
+
91
+
```actionscript
92
+
Image.service.captureScreenshot( null, false );
93
+
```
47
94
48
-
On Android, user permission is required to capture a screenshot. On calling `captureScreenshot` your user may be presented a permission dialog. If they accept then the screenshot will be captured and subsequent screenshots will not require interaction. If they deny the permission then the screenshot will fail with an error event and subsequent screenshot capture attempts will present the permission dialog again.
95
+
#### Permission
96
+
97
+
On Android, user permission is required to capture a screenshot of the full screen. On calling `captureScreenshot()` your user may be presented a permission dialog. If they accept then the screenshot will be captured. If they deny the permission then the screenshot will fail with an error event and subsequent screenshot capture attempts will present the permission dialog again.
98
+
99
+
On older versions of the Android the following permission request is shown:
Copy file name to clipboardExpand all lines: docs/image/changelog.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,10 @@
1
+
### 2025.12.15 [v7.1.0]
2
+
3
+
```
4
+
feat(android): add new capture screenshot functionality to capture application view without user interaction
5
+
fix(android): correct issue with crash on newer android versions while using media projection to capture full screen (resolves https://github.com/distriqt/ANE-Image/issues/57, resolves https://github.com/distriqt/ANE-Image/issues/56)
Copy file name to clipboardExpand all lines: docs/image/migrating-to-v6.0.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,5 +13,5 @@ Particularly due to all the file system changes in Android that require addition
13
13
14
14
Migration should be relatively straight forward, just replace the `Image.service.saveToCameraRoll()` with `CameraRollExtended.service.addBitmapData()`.
15
15
16
-
For more information see the documentation on the [CameraRollExtended](/docs/camerarollextended/adding-files.mdx).
16
+
For more information see the documentation on the [CameraRollExtended](/docs/camerarollextended/adding-files).
This version makes some changes to the Android implementation to support capturing screenshots.
9
+
10
+
We have changed the default operation to use a new method that doesn't require user interaction for permissions but only captures the application window (similar to iOS).
11
+
The previous method that captures the full screen including other applications is still available and has been improved to support the new requirements of using a foreground service but continues to require user permission via a system dialog.
12
+
13
+
This update requires some changes to the manifest additions, so you will need to update your application descriptor accordingly.
14
+
15
+
If you are using [`apm`](https://github.com/airsdk/apm) to manage your extensions you can update your application descriptor automatically by following the instructions below.
16
+
17
+
```
18
+
apm update
19
+
apm generate app-descriptor
20
+
```
21
+
22
+
If you are managing your application descriptor manually you will need to ensure your manifest additions contains the following:
As the default operation has changed to the new method that doesn't require user interaction, if you wish to continue to capture the full screen including other applications you will need to pass `false` to the second parameter of the `captureScreenshot()` method.
Copy file name to clipboardExpand all lines: docs/image/saving-bitmapdata-to-the-camera-roll.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ sidebar_label: Saving BitmapData to the Camera Roll
7
7
:::warning
8
8
This functionality has been deprecated and will be removed in an upcoming release.
9
9
10
-
You should move to the [CameraRollExtended](/docs/camerarollextended/adding-files.mdx) extension for adding images to the Camera Roll.
10
+
You should move to the [CameraRollExtended](/docs/camerarollextended/adding-files) extension for adding images to the Camera Roll.
11
11
12
12
Migration should be relatively straight forward, just replace the `Image.service.saveToCameraRoll()` with `CameraRollExtended.service.addBitmapData()`.
0 commit comments