Quantcast
Channel: Android*
Viewing all articles
Browse latest Browse all 531

Intel XDK Simple Camera Sample

$
0
0

The source code for this sample can be found here: https://github.com/gomobile/sample-imagecapture or download the Intel(R) XDK to check out all the HTML5 Samples.

Purpose

The camera demonstration is a very simple implementation of how the intel.xdk JavaScript Bridge Library can be used to use the device's camera in a hybrid app.

Source Code

The HTML of this app contains images and button DIV elements that are used to display the pictures taken with the camera and interact with the application. Touching the button DIV element triggers the takepicture function found in js/main.js.

When the intel.xdk.camera.takePicture function is triggered, the native camera application on the device is started allowing the user to take a picture. Once a picture is successfully taken, or the camera application is closed, control returns back to the hybrid app and a JavaScript event is thrown.

If the camera app successfully takes a picture, the intel.xdk.camera.picture.add event is thrown. If the user cancels out of the camera application without taking a picture, the intel.xdk.camera.picture.cancel event is thrown instead. In case the application tries to query the camera object while the app's native camera is loaded, the intel.xdk.camera.picture.busy event is thrown. In each of these cases, the onSuccess function acts as an event handler.

The onSuccess event handler reads whether the camera application successfully took a picture or not. In case of an error, the message returned is displayed in an alert box. If the camera was successful, the image URL is used to draw the image to the screen.

After three images are captured with the camera, a quick slide show can be displayed using the makeslideshow function.

Testing

This sample application has been tested on a variety of iOS and Android devices.

Limitations

The camera API relies on the device's native camera taking software. Depending on the device and operating system this sample application runs on, there could be differences and limitations on taking pictures that are out of the application's control.

Viewing all articles
Browse latest Browse all 531

Trending Articles


Vimeo 10.7.1 by Vimeo.com, Inc.


UPDATE SC IDOL: TWO BECOME ONE


KASAMBAHAY BILL IN THE HOUSE


Girasoles para colorear


Presence Quotes – Positive Quotes


EASY COME, EASY GO


Love with Heart Breaking Quotes


Re:Mutton Pies (lleechef)


Ka longiing longsem kaba skhem bad kaba khlain ka pynlong kein ia ka...


Vimeo 10.7.0 by Vimeo.com, Inc.


FORECLOSURE OF REAL ESTATE MORTGAGE


FORTUITOUS EVENT


Pokemon para colorear


Sapos para colorear


Smile Quotes


Letting Go Quotes


Love Song lyrics that marks your Heart


RE: Mutton Pies (frankie241)


Hato lada ym dei namar ka jingpyrshah jong U JJM Nichols Roy (Bah Joy) ngin...


Long Distance Relationship Tagalog Love Quotes