PhoneGap建立网络访问权限

时间:2020-06-22 11:13:57

标签: android phonegap-build

在我在Android手机上构建并安装之前,我的应用程序可以正常运行。当我检查应用程序的权限时,网络访问权限不存在。这是一个问题,因为该应用程序获取流网址,因此播放器失败。 经过测试的Android版本(v 5.1和v 6)正在使用现有权限。 v 9和v 10都拒绝了网络访问。该权限不在应用程序的权限页面上。从Phonegap CLI 9.0.0开始,然后从CLI 8.0.0开始。我的配置文件如图所示

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        xmlns:android = "http://schemas.android.com/apk/res/android"
        id        = "com.myapp.radio"
        version   = "2.0.0">
    <name>MyApp</name>
    <description>
        My app
    </description>
    <author href="http://example.com" email="mail@mail.com">
        Samuel
    </author>
    <preference name="phonegap-version" value="cli-8.0.0"/>
    <preference name="pgb-builder-version" value="2"/>
    <content src="index.html"/>
    <preference name="android-minSdkVersion"  value="21" />
    <preference name="android-targetSdkVersion"  value="28" />
    <preference name="DisallowOverscroll"    value="true" />
    <preference name="android-build-tool" value="gradle" />
    
    <gap:config-file platform="android" parent="/manifest" mode="add">
        <application android:theme="@android:style/Theme.Translucent.NoTitleBar"></application>
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.NETWORK_ACCESS" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    </gap:config-file>
    <plugin name="cordova-plugin-whitelist"  source="npm" spec="1.3.4" />
    <plugin name="cordova-plugin-market" spec="1.2.0"   source="npm" />
    <plugin name="cordova-plugin-dialogs" spec="2.0.2"   source="npm" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2"   source="npm" />
    <plugin name="cordova-plugin-media" spec="3.0.1" />
    <plugin name="cordova-plugin-device" spec="1.1.6" />
    <plugin name="cordova-plugin-inappbrowser"        source="npm" spec="~3.2.0" />
    <plugin name="cordova-plugin-advanced-background-mode"        source="npm" spec="~1.1.0" />
    <plugin name="cordova-plugin-media-capture"       source="npm" spec="~1.4.3" />
    <plugin name="cordova-plugin-file"                source="npm" spec="~4.3.3" />
    <plugin name="cordova-plugin-network-information" source="npm" spec="~2.0.2" />
    <plugin name="cordova-plugin-vibration"           source="npm" spec="~2.1.5" />
    
    <platform name="android">
        <preference name="SplashShowOnlyFirstTime" value="false"/>
        <icon density="ldpi" src="res/icon/android/ldpi.png"/>
        <icon density="mdpi" src="res/icon/android/mdpi.png"/>
        <icon density="hdpi" src="res/icon/android/hdpi.png"/>
        <icon density="xhdpi" src="res/icon/android/xhdpi.png"/>
        <icon density="xxhdpi" src="res/icon/android/xxhdpi.png"/>
        <icon density="xxxhdpi" src="res/icon/android/xxxhdpi.png"/>
        <splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png"/>
        <splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png"/>
        <splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png"/>
        <splash density="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png"/>
        <splash density="port-xxhdpi" src="res/screen/android/splash-port-xxhdpi.png"/>
        <splash density="port-xxxhdpi" src="res/screen/android/splash-port-xxxhdpi.png"/>
        <splash qualifier="port-ldpi" src="res/screen/android/splash-port-ldpi.png"/>
        <splash qualifier="port-mdpi" src="res/screen/android/splash-port-mdpi.png"/>
        <splash qualifier="port-hdpi" src="res/screen/android/splash-port-hdpi.png"/>
        <splash qualifier="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png"/>
        <splash qualifier="port-xxhdpi" src="res/screen/android/splash-port-xxhdpi.png"/>
        <splash qualifier="port-xxxhdpi" src="res/screen/android/splash-port-xxxhdpi.png"/>     
    </platform>
    
    <splash src="splash.png" />
    <preference name="SplashScreen" value="splash" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="auto-hide-splash-screen" value="false" />
    <preference name="SplashMaintainAspectRatio" value="true"/>
    <preference name="SplashScreenDelay" value="6000" />
    
    <platform name="wp8">
        <icon   src="www/res/icon/wp8/ApplicationIcon.png"   platform="wp8" width="99"  height="99" />
        <icon   src="www/res/icon/wp8/Background.png"        platform="wp8" width="159" height="159" />
        <splash src="www/res/screen/wp8/screen-portrait.jpg" platform="wp8" width="768" height="1280" />
    </platform>
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="*" />
    <allow-navigation href="*" />
    <access origin="*" subdomains="true" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <gap:plugin name="cordova-plugin-x-socialsharing" source="npm" spec="5.4.0"/>
</widget>

0 个答案:

没有答案