How To Use the Camera Functionality With PointAbout’s Springboard

February 6, 2009 · Print This Article

Using the camera functionality is very simple using PointAbout’s Springboard.  Using a few lines of javascript you can initiate the camera functionality.


initPA = function() {
Device.init();
Device.Image.uploadUrl = "http://www.example.com/upload_photo?";
Device.Image.callback = imageDoneUploading;
}

imageDoneUploading = function(response) {
document.getElementById("message_box").innerHTML = "Photo has been attached!";

}

Let’s review the code:

line 02:  Here we init the device and tells the Springboard to set device variables
line 03:  Define an upload URL which will accept the POST of the image selected by the user
line 04:  Tell PointAbout’s Springboard to send the callback message to the supplied function

line 07:  define the callback function which we assigned to the Device.Image.callback earlier.
line 08: once we get the callback tell the user the image has been uploaded.

Now thats almost all of it, except now we need to tell the Image controller class to allow the user to take a picture.


Device.Image.getFromPhotoLibrary();

That should bring up the Image picker from the photo library.  Thats it!


<body onload="initPA()" >

lastly we need to call our initialization function “initPA()” with the body’s onload.

Feel free to leave any comments or suggestions below.

Comments

One Response to “How To Use the Camera Functionality With PointAbout’s Springboard”

  1. Dev 101: Getting to know PointAbout | PointAbout: Mobilize Your Brand on March 29th, 2009 2:28 pm

    [...] the example in the developer blog for more [...]

Got something to say?