Warning: ksort() expects parameter 1 to be array, object given in /homepages/3/d382450142/htdocs/BLOG BLANGGO/wp-content/plugins/bbpress/includes/core/template-functions.php on line 316
PhoneGap | Blog | Blanggo.com

Página PhoneGap

PhoneGap  es un framework de desarrollo que permite el uso de la programación de API de dispositivos nativos con Java Script, HTML y CSS que funciona en todas las principales plataformas de desarrollo móvil.

Habilidades necesarias: JavaScript, HTML, CSS.

 

1. Crear una nueva página PhoneGap.

 

1

 

2. Pegue su código  HTML / JS en la página de PhoneGap (HTML Edit Mode) y guarde los cambios:

 

2

 

……………………………………………………………………………………………………………………………………………………………………..

Ejemplo

Datos proporcionados por Pastebin.com – Download Raw – See Original
  1.   <script type=”text/javascript” charset=”utf-8″>
  2.     var pictureSource; // picture source
  3.     var destinationType; // sets the format of returned value
  4.     // Wait for Cordova to connect with the device
  5.     //
  6.     document.addEventListener(“deviceready”,onDeviceReady,false);
  7.     // Cordova is ready to be used!
  8.     //
  9.     function onDeviceReady() {
  10.         pictureSource=navigator.camera.PictureSourceType;
  11.         destinationType=navigator.camera.DestinationType;
  12.     }
  13.     // Called when a photo is successfully retrieved
  14.     //
  15.     function onPhotoDataSuccess(imageData) {
  16.       // Uncomment to view the base64 encoded image data
  17.       // console.log(imageData);
  18.       // Get image handle
  19.       //
  20.       var smallImage = document.getElementById(‘smallImage’);
  21.       // Unhide image elements
  22.       //
  23.       smallImage.style.display = ‘block’;
  24.       // Show the captured photo
  25.       // The inline CSS rules are used to resize the image
  26.       //
  27.       smallImage.src = “data:image/jpeg;base64,” + imageData;
  28.     }
  29.     // Called when a photo is successfully retrieved
  30.     //
  31.     function onPhotoURISuccess(imageURI) {
  32.       // Uncomment to view the image file URI
  33.       // console.log(imageURI);
  34.       // Get image handle
  35.       //
  36.       var largeImage = document.getElementById(‘largeImage’);
  37.       // Unhide image elements
  38.       //
  39.       largeImage.style.display = ‘block’;
  40.       // Show the captured photo
  41.       // The inline CSS rules are used to resize the image
  42.       //
  43.       largeImage.src = imageURI;
  44.     }
  45.     // A button will call this function
  46.     //
  47.     function capturePhoto() {
  48.       // Take picture using device camera and retrieve image as base64-encoded string
  49.       navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
  50.         destinationType: destinationType.DATA_URL });
  51.     }
  52.     // A button will call this function
  53.     //
  54.     function capturePhotoEdit() {
  55.       // Take picture using device camera, allow edit, and retrieve image as base64-encoded string
  56.       navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit:true,
  57.         destinationType: destinationType.DATA_URL });
  58.     }
  59.     // A button will call this function
  60.     //
  61.     function getPhoto(source) {
  62.       // Retrieve image file location from specified source
  63.       navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,
  64.         destinationType: destinationType.FILE_URI,
  65.         sourceType: source });
  66.     }
  67.     // Called if something bad happens.
  68.     //
  69.     function onFail(message) {
  70.       alert(‘Failed because: ‘ + message);
  71.     }
  72.     </script>
  73.     <button onclick=”capturePhoto();”>Capture Photo</button> <br>
  74.     <button onclick=”capturePhotoEdit();”>Capture Editable Photo</button> <br>
  75.     <button onclick=”getPhoto(pictureSource.PHOTOLIBRARY);”>From Photo Library</button><br>
  76.     <button onclick=”getPhoto(pictureSource.SAVEDPHOTOALBUM);”>From Photo Album</button><br>
  77.     <img style=”display:none;width:60px;height:60px;” id=”smallImage” src=”” />
  78.     <img style=”display:none;” id=”largeImage” src=”” />

 

……………………………………………………………………………………………………………………………………………………………………..

 

Resultado:

3

4

 

 

 

Referencias:

PhoneGap | Home
Apache Cordova API Documentation
PhoneGap – Wikipedia

 

 

Blanggo.com