我已经开始研究PhoneGap了。我正在使用PhoneGap构建来编译我的应用程序。我试图使用相机,但我被困在config.xml
经过大量搜索后,我无法找到使用用户权限
任何人都可以告诉我如何在我的config.xml文件中使用它
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
示例XML会很棒。感谢
答案 0 :(得分:3)
将此行添加到config.xml
<feature name="http://api.phonegap.com/1.0/file" /><!-- WRITE_EXTERNAL_STORAGE; required for camera to write to camera roll -->
答案 1 :(得分:0)
您可以在此处查看我的存储库,
AndroidManifest
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.revivalx.cordova.camera" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="CameraCordova" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
config.xml中
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.revivalx.cordova.camera" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="loglevel" value="DEBUG" />
<feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
<name>CameraCordova</name>
<description>
This source code provides example for taking pictures and for choosing images from the system's image library.
</description>
<author email="nurdinnorazanservices@gmail.com" href="http://revivalx.com">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<feature name="Camera">
<param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>
</widget>
教程:http://blog.revivalx.com/2014/05/03/tutorial-camera-cordova-plugin-for-ios-and-android/