This is a premium module, in order to use it you will need to upgrade your project.
camera: Foreground camera
forge.camera namespace can be used to display a camera as part of your app. It is designed for use on older, low-memory Android devices.
This module is only available on Android, on iOS the File and Camera Access will perform a similar function.
Note: This module can be used as a drop in replacement for forge.file.getImage on Android. Unlike that API, this module will display the camera as part of your app. This means the user will not have the option to select an image from the gallery, or perform advanced options such as zooming or changing other camera settings. However, on low memory devices this can be a more reliable method of capturing a photo.
This module uses file objects: it is recommended you process them using the file module.
forge.camera.getImage([params, ]success, error)¶
Returns a file object for a image taken using their camera. Images are always saved in your app's "pictures" directory. The file object can be handled using the File and Camera access module.
objectan optional object of parameters
function(file)callback to be invoked when no errors occur (argument is the returned file)
function(content)called with details of any error which may occur
The optional parameters can contain any combination of the following:
width: The maximum height of the image when used, if the returned image is larger than this it will be automatically resized before display. The stored image will not be resized.
widthbut sets a maximum height, both
widthcan be set.
Returned files will be accessible to the app as long as they exist on the device.
On Android this module will add the
CAMERA permissions to your app, users will be prompted to accept this when they install your app.