Log in or register to post comments

Camera hangs up !!!!!

February 13, 2011 - 10:45pm #1

Hi Iam developig an augmented reality application where in qualcomm image recognition is a part of it......

Since qualcomm image recognition takes the ownership of camera and so we can not open camera in android and carry on with our normal image recognition by qualcomm.......

So i am openning camera in qualcomm and carrying out other processings on that like qualcomm image recognition, adding up of augmented view to display points of interests calculated through gps values and various other viewss..

But my problem is that if i exit my applicaiton and again restart the applicaiton from home my camera hangs up and it stops rendering video background..Or if come back from another activity to this camera activity(which is a part of my applicaiton only) then again camera hangs up......Also I have to reboot the phone to make it working.

Can you please tell me what could be the reason?

Re: Camera hangs up !!!!!

March 17, 2011 - 5:54am #6

Did you move the camera stop and start logic back to onPause and onResume? Having it in onDestroy isn't enough, because this isn't called when the app is pushed to the background. Make sure that you're stopping everything in onPause like the sample applications show. That includes pausing the glView, pausing QCAR, and stopping the camera.

- Kim

Re: Camera hangs up !!!!!

March 16, 2011 - 9:41pm #5

Hi Kim

I implemented a custom view over camera and removed all the activities but still the problem persists.

When I come out of my appllication and launch it again from the application launcher the camera hangs up....it stops rendering the video...

Any idea??

Re: Camera hangs up !!!!!

March 10, 2011 - 5:29am #4

You have to be careful about using multiple activities without properly pausing the QCAR activity. Typically, when an activity covers the AR activity, everything is paused: QCAR, the camera, and the glView. The glView shouldn't be rendering at all when it's paused, which means the video background won't update.

Would it be possible to overlay a custom view on top of the AR view, instead of starting a new activity? That's a simple way to handle this scenario, as onPause won't be called at all.

As far as battery life goes, running the camera, tracker, and an OpenGL view is going drain the battery faster than more passive applications.

- Kim

Re: Camera hangs up !!!!!

March 10, 2011 - 3:47am #3

Hi Kim

No Iam not facing this problem in the original sample.

Yes Iam doing QCAR.onPause the way it is done in imagetargets.

But instead of doing it in activity's onPause Iam invoking this method in onDestroy of the activity as that is my requirement since when my any image is recognised i need to display another activity with its background as transparent having camera view at its background,hence cant call QCAR.onPause in activity's onPause method.
Similarly calling QCAR.onResume in the onStart method.

Plus the code:
if (mAppStatus == APPSTATUS_CAMERA_RUNNING)
{
updateApplicationStatus(APPSTATUS_CAMERA_STOPPED);
}

is being done in onDestroy and the code to start it again is done in onStart.

But when I start my application again camera video hangs up and it seems as if it has stopped rendering the camera view :(.

Also I have one more doubt that if i have this application in my phone ,the battery drains up very fast.

Re: Camera hangs up !!!!!

February 14, 2011 - 5:48am #2

Do you see the same problem when you run the sample applications without modification?

Be sure to pause QCAR and stop the camera when your Activity pauses, and to restart them when the Activity resumes. See ImageTargets.java, here's the relevant pausing code:

// QCAR-specific pause operation
QCAR.onPause();

if (mAppStatus == APPSTATUS_CAMERA_RUNNING)
{
    updateApplicationStatus(APPSTATUS_CAMERA_STOPPED);
}

- Kim

Log in or register to post comments