Start a new topic

AR.hardware.camera.enabled=false - does it actually release the camera

AR.hardware.camera.enabled=false - does it actually release the camera


Oh .  I understand.  We kind of need this option on a device which has Android api level 15.  So we can not use Wikitude 5.x.  Is there 'any' way we could backport this / achieve this on to earlier version of WIkitude ( 4.0.3 ) ?    

 

Thanks for your help Andreas.

regds

abhay

From this reference,

http://www.wikitude.com/external/doc/documentation/4.1/Reference/JavaScript%20Reference/classes/hardware.html#property_camera.enabled

camera can be disabled by using, 

AR.hardware.camera.enabled=false;

 

and it works great. Shows black background. 

First Question is if it really releases the device camera ? As on my android device, the 'camera in use' light is still blinnking eventhough the hardware.camera.enabled is set to false and application screen is black. 

Also when i enable it again through the code - 

AR.hardware.camera.enabled=true;

 

it doesn't enable the camera ( does not show any effect on the app screen). The screen is still black.  What I have observed that, after this point if I bring up any other activity (i.e. basically put my app activity in background) and then bring up my app activity again in foreground ( onresume ), the camera view is loaded correctly.

So the Second Question is, do we need to call any other function to enable the camera view again ??  How does putting the activity in background  and bringing it up again (effectively calling architectView.onResume() ) help ?

 

 

 

 

For my First Question above, Wikitude is certainly not releasing the camera ... as I can see from the logcat.  So disabling wikitude camera might help from application performance standpoint, but not from device resources ( camera, battery ) standpoint .. camera will remain ON and it will continue to drain the battery. @Wikitude experts .. could you please confirm ?

Also, for the Second Question above, I tried this and it works.


Inside the javascript,
--------------------------------


function cameraOff()
{
AR.hardware.camera.enabled=false;
}

function cameraOn()
{
AR.hardware.camera.enabled=true;
}

Inside Activity Class
---------------------------------------


private void turnOffCamera() {
this.architectView.callJavascript("cameraOff()");
}
private void turnOnCamera() {
this.architectView.callJavascript("cameraOn()");
try {
this.architectView.onPause();
this.architectView.onResume();
}catch (Exception re){}
}

 

But I feel this (calling onPause() and then onResume() ) is not the right way of re-loading camera view after enabling the AR.hardware.camera Again, @Wikitude experts, could you please advise ?

 

Regards

Abhay

 

Hi Abhay,
In our next minor udpate, we unify the Android Camera handling across all Android products. After that, the camera will be relesed if you disable the camera hardware in your js code. It then should not be necessary anymore to call onPause/onResume afterwards manually.

The next update will be available end of April/beginning of May. If you can't wait that long, your second solution is fine but as you already mentioned, is a workaround.

Best regards

Andreas

I'm afraid that if your workaround does not work on api level 15 (SDK 4.x), I can't help you. Maybe you can contact our sales team (sales@wikitude.com) to talk about a SDK 5 discount.

Best regards

Andreas

Any insights on this one, experts ? We need to make some design decisions based on this .. So this is urgent.

Thanks

Abhay

Hello Andreas,

Thanks .. That is a good news .. Is this going to be update to release 5+ ? Because of device restriction/s for now atleast, we are tied to version 4.* Wikitude SDK .. if it is only update to version 5.* , would it be possible to backport on 4.* ?

regards

Abhay

Hi Abhay,
It's SDK 5.x only. We don't release updates for previous SDK versions. Sorry. 

Best regards

Andreas
Login or Signup to post a comment