Android PhoneGap Config XML user-permission

霸气de小男生 提交于 2019-12-12 02:55:12

问题


I have started working on PhoneGap. I am using PhoneGap build to compile my app. I was trying to use the camera but I am stuck in config.xml

After alot of searching everywhere I am not able to find away to use user-permission

Can anyone please tell me how I can use this in my config.xml file

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

A sample XML would be great. Thanks


回答1:


Add this line to your config.xml

<feature name="http://api.phonegap.com/1.0/file" /><!-- WRITE_EXTERNAL_STORAGE; required for camera to write to camera roll -->



回答2:


You can check my repository here,

https://github.com/datomnurdin/com.revivalx.cordova.camera/blob/master/platforms/android/AndroidManifest.xml

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>

Tutorial: http://blog.revivalx.com/2014/05/03/tutorial-camera-cordova-plugin-for-ios-and-android/



来源:https://stackoverflow.com/questions/26440655/android-phonegap-config-xml-user-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!