Skip to main content
Participant
November 6, 2012
Answered

Can't same bitmap to cameraRoll in Android 4

  • November 6, 2012
  • 4 replies
  • 1574 views

I am using the following code to allow users to save drawings to the mobile device's cameraRoll:


var cameraRoll:CameraRoll = new CameraRoll();

var bitmapData:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight);

bitmapData.draw(MovieClip(root).stage);

cameraRoll.addBitmapData(bitmapData);

The code works as expected on tested devices including iOS 5 and 6 with an iPhone 4 and iPad 3, and various flavors of Android 2.x and 3. It does not, however, work on Android 4.x (tested with 4.0, 4.1 and 4.2 on a Galaxy Nexus). The results are the same compiled using Adobe AIR 3.2 and 3.4. Is there some magic code I should be using to save images to Android 4?

My app is being compiled on Windows 7 using Adobe Flash Professional CS6 (12.0.2.529).

This topic has been closed for replies.
Correct answer actionfiguredaniel

As a matter of fact, I just did. It turns out that I needed to select the "WRITE_EXTERNAL_STORAGE" permission. Android 4 must count writing to the cameraroll as accessing external storage where Android 2 does not.

4 replies

Known Participant
November 14, 2012

Did you have any joy solving this? I am also experiencing trouble trying to save to the camera roll on my Nexus 7 with Android 4.1.2

Published app with Flash CS6 and AIR 3.4

My code works fine on iPad.

Would be great to know if it is something I am doing wrong or if it is a bug?

Thanks

UPDATE: The same code works fine on Android HTC Desire Phone with Android 2.x

Have tested compiling with Air 3.5 and the problem still exists

actionfiguredanielAuthorCorrect answer
Participant
November 14, 2012

As a matter of fact, I just did. It turns out that I needed to select the "WRITE_EXTERNAL_STORAGE" permission. Android 4 must count writing to the cameraroll as accessing external storage where Android 2 does not.

Known Participant
November 14, 2012

That is fabulous news!! I thought you and I were the only 2 people on the planet experiencing this issue.

Works perfectly with the "WRITE_EXTERNAL_STORAGE" permission.

Many thanks for replying.