I am trying to open the front camera directly with Intent
. Below is my code --
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
intent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
}
My manifest file :--
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="some.package">
<uses-permission android:name="android.permission.INTERNET" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
This code is not working on S6(7.0). However it is working on S5,S4,Nexus 6P(8.0).
So is this some kind of bug of Samsung or there is something wrong in my code.
I have found some similar questions like this and this. But not helpful in my case.
I am trying to open the front camera directly with Intent
There is nothing for that in the Android SDK.
Below is my code
There are hundreds, perhaps thousands, of different camera apps available for Android. Some are pre-installed; some are user-installed. None have to honor those undocumented Intent
extras.
This code is not working on S6(7.0). However it is working on S5,S4,Nexus 6P(8.0).
There are ~20,000+ Android device models. Only some might have a pre-installed camera app that honors those undocumented Intent
extras.
So is this some kind of bug of Samsung or there is something wrong in my code.
Samsung's camera app for that particular device simply does not honor those undocumented extras.