Rajani Dhawan
Rajani Dhawan

Reputation: 27

Is it possible to take photos programmatically without bringing the default camera application into foreground in blackberry.....?

I am developing an application which makes use of camera...and my app's requirement is :

I have to take photos from my "already running" background application ; but I have to keep camera application into background......means I want to capture picture without disturbing the current foreground applications.

and in addition without making any camera shutter sound....???

Is this possible If we call camera app - through Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments())...........


thanks to all of u...specially to @donturner .....sorry to come back on this post very late.

after some attempts I hv found that without bringing the camera screen into foreground we cant capture the snap.

1) If we put the camera screen into background OR

2) change the visibility of VideoControl's class object as false...

_videoControl.setVisible(false);

then no bytes (null value) will be received by...

byte[] imageBytes = _videoControl.getSnapshot( encoding );   

So whats the use of this function....while we r using the video control class for capture snap or video???

_videoControl.setVisible(true);

I hv tried a different trick......

I hv tested the above trick on BB Flip (4.6) and Storm (5.0) devices and it takes snapshots successfully even when device back light is OFF.

But now I become stuck on some other problem....and that is the camera SHUTTER sound. I hv tried a lot but couldn't get success to mute it....

as @Michael Donohue suggested, I hv tried..

private void muteThread() {
        Thread t = new Thread(new Runnable() {
            public void run() {
                try {
                    int i = 0;
                    while (i < 50) {
                        Audio.setVolume(0);
                        try {
                            Thread.sleep(50);
                        } catch (InterruptedException e) {                      
                        }
                        i++;
                    }
                    System.out.println("\n\n >>>>> End of Mute Thread. <<<< \n\n");
                } catch (Exception e) {
                }
            }
        });
        t.start();
    }

but it is not working... If this cant be done then how these application r providing this facility...and wht kind of functionality they hv used.

http://appworld.blackberry.com/webstore/content/97648/?lang=en

http://appworld.blackberry.com/webstore/content/79083/?lang=en

Upvotes: 0

Views: 835

Answers (1)

donturner
donturner

Reputation: 19156

You cannot take a photo programmatically without displaying the camera preview feed to the user so at the very minimum you need to bring the camera preview surface into the UI foreground.

Upvotes: 0

Related Questions