[英]Launch front camera with intent
我正在嘗試使用Intent
直接打開前置攝像頭。 以下是我的代碼-
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);
}
我的清單文件:-
<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" />
該代碼不適用於S6(7.0)。 但是,它適用於S5,S4,Nexus 6P(8.0)。
這是三星的某種錯誤,還是我的代碼有問題。
我正在嘗試使用Intent直接打開前置攝像頭
Android SDK中沒有適用於此的功能。
下面是我的代碼
適用於Android的數百甚至數千個不同的相機應用程序。 有些是預裝的。 有些是用戶安裝的。 沒有人必須尊重那些未記錄的Intent
附加功能。
該代碼不適用於S6(7.0)。 但是,它適用於S5,S4,Nexus 6P(8.0)。
大約有20,000多種Android設備型號。 只有某些人可能預裝了可滿足那些未記錄的Intent
附加功能的相機應用。
這是三星的某種錯誤,還是我的代碼有問題。
三星針對該特定設備的相機應用根本無法兌現這些未記錄的附加功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.