framework/src/org/apache/cordova/CameraLauncher.java
/**
     * Executes the request and returns PluginResult.
     *
     * @param action        The action to execute.
     * @param args          JSONArry of arguments for the plugin.
     * @param callbackId    The callback id used when calling back into JavaScript.
     * @return              A PluginResult object with a status and message.
     */
Executes the request and returns PluginResult.
@param action        The action to execute.
@param args          JSONArry of arguments for the plugin.
@param callbackId    The callback id used when calling back into JavaScript.
@return              A PluginResult object with a status and message.
Executes the request and returns PluginResult . @param action The action to execute . @param args JSONArry of arguments for the plugin . @param callbackId The callback id used when calling back into JavaScript . @return A PluginResult object with a status and message .
public PluginResult execute(String action, JSONArray args, String callbackId) {
        PluginResult.Status status = PluginResult.Status.OK;
        String result = "";
        this.callbackId = callbackId;
        try {
            if (action.equals("takePicture")) {
                int srcType = CAMERA;
                int destType = FILE_URI;
                this.saveToPhotoAlbum = false;
                this.targetHeight = 0;
                this.targetWidth = 0;
                this.encodingType = JPEG;
                this.mediaType = PICTURE;
                this.mQuality = 80;
                this.mQuality = args.getInt(0);
                destType = args.getInt(1);
                srcType = args.getInt(2);
                this.targetWidth = args.getInt(3);
                this.targetHeight = args.getInt(4);
                this.encodingType = args.getInt(5);
                this.mediaType = args.getInt(6);
                this.saveToPhotoAlbum = args.getBoolean(9);
                if (srcType == CAMERA) {
                    this.takePicture(destType, encodingType);
                }
                else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) {
                    this.getImage(srcType, destType);
                }
                PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
                r.setKeepCallback(true);
                return r;
            }
            return new PluginResult(status, result);
        } catch (JSONException e) {
            e.printStackTrace();
            return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
        }
    }
public PluginResult execute ( String action , JSONArray args , String callbackId ) { PluginResult . Status status = PluginResult . Status . OK ; String result = "" ; this . callbackId = callbackId ; try { if ( action . equals ( "takePicture" ) ) { int srcType = CAMERA ; int destType = FILE_URI ; this . saveToPhotoAlbum = false ; this . targetHeight = 0 ; this . targetWidth = 0 ; this . encodingType = JPEG ; this . mediaType = PICTURE ; this . mQuality = 80 ; this . mQuality = args . getInt ( 0 ) ; destType = args . getInt ( 1 ) ; srcType = args . getInt ( 2 ) ; this . targetWidth = args . getInt ( 3 ) ; this . targetHeight = args . getInt ( 4 ) ; this . encodingType = args . getInt ( 5 ) ; this . mediaType = args . getInt ( 6 ) ; this . saveToPhotoAlbum = args . getBoolean ( 9 ) ; if ( srcType == CAMERA ) { this . takePicture ( destType , encodingType ) ; } else if ( ( srcType == PHOTOLIBRARY ) || ( srcType == SAVEDPHOTOALBUM ) ) { this . getImage ( srcType , destType ) ; } PluginResult r = new PluginResult ( PluginResult . Status . NO_RESULT ) ; r . setKeepCallback ( true ) ; return r ; } return new PluginResult ( status , result ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; return new PluginResult ( PluginResult . Status . JSON_EXCEPTION ) ; } }
Executes the request and returns PluginResult.
Executes the request and returns PluginResult .