Camera not opening in redmi 3s prime (Android)
Camera not opening in redmi 3s prime (Android)
I've made an android application that uses the camera to capture the image, i've tested it on a few devices and it works fine, but recently i came across a phone (Redmi 3s prime ). In this phone, when i open the app it shows a blank screen. i want to know if something is wrong with the phone or my code.
// permission for the camera
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions, @NonNull int grantResults) {
switch (requestCode){
case RequestCameraPermissionID:
{
if(grantResults[0] == PackageManager.PERMISSION_GRANTED)
{
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED){
return;
}
try {
cameraSource.start(cameraView.getHolder());
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
setting up the camera
// setting the parameters for the camera
cameraSource = new CameraSource.Builder(getApplicationContext(),textRecognizer)
.setFacing(CameraSource.CAMERA_FACING_BACK)
.setRequestedPreviewSize(1280,1024)
.setRequestedFps(60.0f)
.setAutoFocusEnabled(true)
.build();
these are the permission ive given in the manifest
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.