I have built my custom camera app using cwac-library. I am trying to access exif data for the images captured using front camera, but exif tags like TAG_GPS_LATITUDE, TAG_GPS_LATITUDE_REF, TAG_GPS_LONGITUDE, TAG_GPS_LONGITUDE_REF, TAG_MAKE, TAG_MODEL.. is returning null. Only tag working is TAG_DATETIME. This only happens for the pictures taken using front camera, every tag is perfectly returning values for the images taken using rear camera
Any thing I am missing while using front-camera?
Including Codes
Custom Camera Fragment Class
public class CustomCameraFragment extends CameraFragment {
static CustomCameraFragment newInstance() {
return new CustomCameraFragment();
}
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
SimpleCameraHost.Builder builder = new SimpleCameraHost.Builder(new CustomCameraHost(getActivity()));
builder.useFullBleedPreview(true);
builder.useFrontFacingCamera(true);
builder.mirrorFFC(true);
setHost(builder.build());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View cameraView = super.onCreateView(inflater, container, savedInstanceState);
View fragmentView = inflater.inflate(R.layout.camera_fragment, container, false);
FrameLayout cameraPreview = (FrameLayout)fragmentView.findViewById(R.id.camera_preview);
((ViewGroup)cameraPreview).addView(cameraView);
return fragmentView;
}
}
Custom Camera Host Class
public class CustomCameraHost extends SimpleCameraHost {
public CustomCameraHost(Activity activity) {
super(activity);
}
@Override
public Parameters adjustPictureParameters(PictureTransaction xact, Parameters parameters) {
Location location = LocationUtils.getLastKnownLocation();
parameters.setGpsLatitude(location.getLatitude());
parameters.setGpsLongitude(location.getLongitude());
parameters.setGpsProcessingMethod(location.getProvider().toUpperCase());
if (location.hasAltitude()) {
parameters.setGpsAltitude(location.getAltitude());
} else {
parameters.setGpsAltitude(0);
}
if (location.getTime() != 0) {
// Location.getTime() is UTC in milliseconds. Gps-timestamp is UTC in seconds.
long utcTimeSeconds = location.getTime() / 1000;
parameters.setGpsTimestamp(utcTimeSeconds);
}
return super.adjustPictureParameters(xact, parameters);
}
}