Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera won’t focus / stay focused in Appcelerator app

After using the app for a while and taking dozens and dozens of photos successfully, users report the Camera will not autofocus and the photos are blurry using our Appcelerator app.

What is causing the camera app not to auto-focus?

This has been reported by a number of users on different model (iPad) devices.

We are taking a lot of photo's and it is difficult to determine why/what makes the camera auto-focus stop working. The code to capture the photo/image is very basic and shown below:

            Ti.Media.showCamera(
                {   showControls:true,
                      mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO],
                         success:function(e){
                                     try{
                                            imgPhoto.image = e.media;                                              
                                     }
                                     catch(e){                                                          
                                        require('lib/Error').Capture(e);                                        
                                     }      
                                },
                       error:function(e){
                                require('lib/Error').Capture(e);
                             }
             }); 

Obviously we tried resetting the device, killing the app, etc. and these solutions fix the problem temporarily. Any solid advice is appreciated.

like image 484
Newport99 Avatar asked Sep 11 '17 18:09

Newport99


1 Answers

Have you tried the below in tiapp.xml

<key>UIRequiredDeviceCapabilities</key>

<array>
  <string>auto-focus-camera</string>

Let me know if this helps you.

like image 137
A. A. Sebastian Avatar answered Sep 24 '22 17:09

A. A. Sebastian