Posts Tagged ‘ Flex Development

Beginning Mobile Development with Flash Builder 4.6 – Camera API Troubleshooting

I have been running into simple problems during my Flash Builder 4.6 mobile development research and I want to add my voice to the Interwebs!

Flash Builder 4.6 Camera API:  

NOTE: I am only posting the musings of my problems, if you want to learn how this all works, go check this out:

Michael Chaize: Android, AIR, and the Camera
Christian Cantrell: How to Use CameraUI in a Cross-platform Way
Uploading images from CameraRoll and CameraUI

My Goal for this project: To build a universal application that would use the camera in either the iOS and Android platforms.

In order to access the camera in any mobile device you will be working with the CameraUI class used in the AIR 2.5 runtime.  My first problem?  I didn’t read the introductory paragraphs in the liveDocs… they describe everything that you must adhere to in order to have a smooth experience.

A couple of things that are obvious to me now, but weren’t clear when I started:

1.  Know what a Device Profile is .  Adobe does a perfect job of explaining why you can’t test the camera in certain environments.  Go learn why.  If you understand profiles, then you will know what your limitations are right from the start.  Because I didn’t know, I lost a lot of time trying to get a laptop operating like a native app would.

2. You can’t access an android camera if the device doesn’t have a memory card.  This drove me crazy because my iPhone camera responded quickly and the android camera didn’t even activate.  I had to /facepalm when I re-read the liveDocs again only to find that you must have a memory card to access the camera.  I am on a loaner android phone so it didn’t make sense until I read the fine print.

3. If you want to add permissions or change settings after you have created your app, you will have to edit the Adobe AIR Application Descriptor File.   I found that I didn’t have the correct permissions for my android device and didn’t see an easy way out of my problem.  After some reading I found that I could edit the descriptor file in my project.  The actual file is located in the SRC root and tt has the same name as your app.  The file will usually look like this “YourAppName-app.xml” Make sure you don’t edit the descriptor file in the bin folder as that is just a copy and won’t have any effect on future builds.

I am going to be posting more as I will inevitably have more issues along the way.  Thanks for reading!