I'm trying to replicate an app that gets some hardware information of a device.
I figured this to get the camera specifications but sometimes it gets the wrong data based on the sensor size (for example, 16Mp when it has to be 13).
Any idea on how to fix this?
public static String getCamera(SogMainActivity act) {
if (camera != null) return camera;
CameraManager manager = (CameraManager) act.getSystemService(Context.CAMERA_SERVICE);
List<String> result = new ArrayList<String>();
try {
String[] cids = manager.getCameraIdList();
for (String cid : cids) {
SizeF sf = manager.getCameraCharacteristics(cid).get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE);
String mpSize = (int)(sf.getHeight() * sf.getWidth()) + " MP ";// + sf.getHeight() + " x " + sf.getWidth() ;
result.add(mpSize);
}
} catch (Exception e){
result.add("Error");
}
return TextUtils.join(" + ", result);
}