I'm trying to use the camera2 api from my Unity app via the safe (but slow, I know) AndroidJavaObject method.
I've worked out how to get to the camera manager, and how to get to the camera characteristics object/class, but to use the functionality you have to pass a Key, namely a CameraCharacteristics.NAME OF KEY HERE...
I learned that you can use $ on the end when trying to get classes that are enums, but that doesn't seem to work here. I'd rather not try to just fudge it and pass some int value that I scrounge up from the java source (if it's even possible to get that value), because for one thing, I'm not sure that would even work since the java side is expecting a CameraCharacteristics.Key
Does anyone have any ideas how to pass something like this?
Thanks,
Cynthia
//camera2 (21+ version) class retrieval method (first get unity activity, as currentactivity, then...
AndroidJavaObject camera2Mgr = currentActivity.Call("getSystemService", "camera");
if (camera2Mgr != null) { //use try catch instead, but for testing, check nullity
//get cameracharacteristics on chosen camera device (id) using the manager
//camera id already chosen earlier and passed in as parameter
String[] cameraList = camera2Mgr.Call("getCameraIdList");
AndroidJavaObject cameraCharacteristics = camera2Mgr.Call("getCameraCharacteristics", cameraList[0]); //cameraId);
// now need to call... cameraCharacteristics.Call("get",
CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
//how do I pass this key?
//tried creating the key as a class, with both $KEY and $INFO_SUPPORTED_HARDWARE_LEVEL
//but get class not found exception...so that doesn't seem to be the way to get at the right key needed
AndroidJavaClass cchl = new AndroidJavaClass("android.hardware.camera2.CameraCharacteristics$KEY");