Skip to content

Commit fd8dcbb

Browse files
committed
It's more likely that the Android device will respect PreferredCamera.Front
1 parent 50421b0 commit fd8dcbb

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed

.github/AAR Source (Android)/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<uses-sdk android:targetSdkVersion="4" />
1212
<uses-feature android:name="android.hardware.camera" android:required="false" />
13+
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
1314
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="replace" />
1415
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace" />
1516
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" tools:node="replace" />

.github/AAR Source (Android)/java/com/yasirkula/unity/NativeCameraUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,25 @@ else if( isXiaomiOrMIUI < 0 )
131131
}
132132

133133
// Credit: https://github.com/jamesmontemagno/MediaPlugin/issues/307#issuecomment-356199135
134+
// Credit: https://stackoverflow.com/a/67288087/2373034
134135
public static void SetDefaultCamera( Intent intent, boolean useRearCamera )
135136
{
136137
if( useRearCamera )
137138
{
138139
intent.putExtra( "android.intent.extras.LENS_FACING_BACK", 1 );
139140
intent.putExtra( "android.intent.extras.CAMERA_FACING", 0 );
140141
intent.putExtra( "android.intent.extra.USE_FRONT_CAMERA", false );
142+
intent.putExtra( "com.google.assistant.extra.USE_FRONT_CAMERA", false );
141143
}
142144
else
143145
{
144146
intent.putExtra( "android.intent.extras.LENS_FACING_FRONT", 1 );
145147
intent.putExtra( "android.intent.extras.CAMERA_FACING", 1 );
146148
intent.putExtra( "android.intent.extra.USE_FRONT_CAMERA", true );
149+
intent.putExtra( "com.google.assistant.extra.USE_FRONT_CAMERA", true );
150+
151+
intent.putExtra( "camerafacing", "front" );
152+
intent.putExtra( "default_camera", "1" );
147153
}
148154
}
149155

118 Bytes
Binary file not shown.

Plugins/NativeCamera/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Native Camera for Android & iOS (v1.3.6) =
1+
= Native Camera for Android & iOS (v1.3.7) =
22

33
Online documentation & example code available at: https://github.com/yasirkula/UnityNativeCamera
44
E-mail: yasirkula@gmail.com

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.nativecamera",
33
"displayName": "Native Camera",
4-
"version": "1.3.6",
4+
"version": "1.3.7",
55
"documentationUrl": "https://github.com/yasirkula/UnityNativeCamera",
66
"changelogUrl": "https://github.com/yasirkula/UnityNativeCamera/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityNativeCamera/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)