Twomz
Twomz

Reputation: 712

Find out if iOS device has autofocus camera using phonegap

I've added a plugin to scan barcodes in our app and right now I'm checking the device model number (ie iPhone4,1) to see if it is a newer device that has an autofocus camera. This will of course either require us to add new devices everytime they come out or we'll forget to do it and the users won't be able to scan barcodes even though they should be able to.

What I would like to do is check to see if the device has an autofocus camera, and use that to allow or deny the users to try to scan barcodes. Anyone know how?

Upvotes: 2

Views: 1098

Answers (1)

Devgeeks
Devgeeks

Reputation: 5647

You could use isFocusModeSupported from the AVCaptureDevice class in iOS.

Documentation is under 'Focus settings' here:

http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/occ/cl/AVCaptureDevice

Upvotes: 5

Related Questions