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.

Alex
  • 1,103
  • 1
  • 11
  • 24

1 Answers1

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

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • 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 '13 at 19:33