platformservices_20_specific.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. var transactionIDCamera = "";
  2. var camera = null;
  3. function initCamera(){
  4. try {
  5. camera = nokia.device.load("camera");
  6. }
  7. catch (e) {
  8. var error = e.toString();
  9. alert(error);
  10. }
  11. }
  12. /*
  13. Starts the device camera, showing the camera user interface, and
  14. assigns callBack function onCameraStart.
  15. */
  16. function startCamera(){
  17. try {
  18. var transactionIDCamera = camera.startCamera(onCameraStart);
  19. }
  20. catch (e) {
  21. var error = e.toString();
  22. alert(error);
  23. }
  24. }
  25. /*
  26. onCameraStart function calls display method and passes outPut containing
  27. taken pictures array(urls) as parameter
  28. Function is invoked asynchronously after the user takes a picture.
  29. The point where the callback is invoked is implementation dependent since
  30. camera UI's differ in how pictures are handled, but it should be called at the point
  31. where the image is initially stored or otherwise disposed of.
  32. However, in an implementation where the calling browser/runtime is suspended
  33. while the viewfinder is running, the callback cannot be invoked after each shutter press and
  34. must be invoked after the viewfinder exits.
  35. In order to handle multiple pictures in a single callback, the callback
  36. picture parameter is specified as an array.
  37. */
  38. function onCameraStart(outPut){
  39. try {
  40. showImages(outPut);
  41. }
  42. catch (e) {
  43. var error = e.toString();
  44. alert(error);
  45. }
  46. }
  47. function onCameraStartError(err){
  48. alert(err.toString());
  49. }