From 3e71ec7b12021c2d123846de5325f991fda9eaf4 Mon Sep 17 00:00:00 2001 From: Christophe Boucaut Date: Mon, 10 Nov 2014 10:09:52 +0100 Subject: [PATCH] Test d'appel de la camera depuis le plugin. --- plugin.xml | 2 ++ .../geneanet/customcamera/CameraLauncher.java | 17 +++++++++++++++++ www/customCamera.js | 16 ++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/android/src/org/geneanet/customcamera/CameraLauncher.java diff --git a/plugin.xml b/plugin.xml index 4a35b62..987b961 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,5 +21,7 @@ + + \ No newline at end of file diff --git a/src/android/src/org/geneanet/customcamera/CameraLauncher.java b/src/android/src/org/geneanet/customcamera/CameraLauncher.java new file mode 100644 index 0000000..09b8d36 --- /dev/null +++ b/src/android/src/org/geneanet/customcamera/CameraLauncher.java @@ -0,0 +1,17 @@ +package org.geneanet.customcamera; + +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CallbackContext; +import org.json.JSONArray; +import org.json.JSONException; + +import android.content.Intent; + +public class CameraLauncher extends CordovaPlugin { + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { + Intent intent = new Intent("org.geneanet.customcamera.CameraView"); + cordova.startActivityForResult((CordovaPlugin) this, intent, 1111111); + + return true; + } +} diff --git a/www/customCamera.js b/www/customCamera.js index 36988f2..5a31439 100644 --- a/www/customCamera.js +++ b/www/customCamera.js @@ -15,4 +15,20 @@ customCameraExport.prototype.getPicture = function() { alert("Oh yeah !"); }; +customCameraExport.prototype.startCamera = function() { + cordova.exec( + function(result) { + console.log("success"); + console.log(result); + }, + function(result) { + console.log("fail"); + console.log(result); + }, + "CameraLauncher", + "customCamera", + [] + ); +}; + module.exports = new customCameraExport(); \ No newline at end of file