0

I'm trying to create an AVD that is completely stripped down: no GPS, no camera, etc. This is to mimic users that have absolutely awful phones that lack even the most basic things.

I've created an AVD that targets Android 1.6 and turned off GPS, but can't find a way to disable the camera.

I have tried adding "hw.camera = no" to the AVD's ini file, but that doesn't seem to help.

Whenever my app runs on the AVD, it still detects a camera, Camera.open() still returns a Camera object, and I even get a picture from it (some black and white squares that the emulator generates). Does anyone know how to just remove the presence of a camera altogether? I need Camera.open() to fail so I can see how my app behaves under those conditions.

1 Answer 1

0

If all else fails, make a Factory class.

class CameraFactory{
    boolean debugMode;
    static Camera open(){
        if(debugMode){
            return null;  //or whatever it does, throw an exception?
        }
        else{
            return real_camera_open;
    }
}

Then you can fake not having a camera on good hardware

1
  • 1
    True, and I might go that route, but it's not exactly elegant. I'd rather see what happens when a device doesn't have a camera, preferably without purchasing one =/
    – Alex
    Jan 11, 2013 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.