9
0
mirror of https://gitee.com/shuto/customCamera.git synced 2026-05-02 00:07:24 +08:00
Files
customCamera/src/android/CameraLauncher.java
T

33 lines
1.0 KiB
Java
Raw Normal View History

package org.geneanet.customcamera;
import XXX_NAME_CURRENT_PACKAGE_XXX.CameraView;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
2014-11-19 11:33:05 +01:00
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import android.content.Intent;
import android.os.Bundle;
public class CameraLauncher extends CordovaPlugin {
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
2014-11-19 11:33:05 +01:00
if (action.equals("startCamera")) {
Intent intent = new Intent(this.cordova.getActivity(), CameraView.class);
2014-11-19 11:33:05 +01:00
Bundle imgBackgroundBase64 = new Bundle();
imgBackgroundBase64.putString("imgBackgroundBase64", args.getString(0));
intent.putExtras(imgBackgroundBase64);
2014-11-19 11:33:05 +01:00
cordova.getActivity().startActivity(intent);
2014-11-19 11:33:05 +01:00
PluginResult r = new PluginResult(PluginResult.Status.OK, "base64retour");
callbackContext.sendPluginResult(r);
return true;
}
return false;
}
}