如何在Android Cordova应用上启用网络请求

时间:2019-05-31 08:43:48

标签: cordova cordova-plugins

我的Cordova应用程序中有一个Radiojar小部件,用于流式传输互联网广播。当我在浏览器中运行该应用程序时,小部件可以正常工作,但是当我在android设备/模拟器上运行该应用程序时,它不起作用/

我已经将<access origin="*" />添加到了config.xml并安装了cordova-plugin-whitelist

这是我的config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="org.christsheart" android-versionCode="2" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Christs Heart</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <preference name="ShowSplashScreenSpinner" value="false"/>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
            <application android:usesCleartextTraffic="true" />
        </edit-config>
        <icon density="ldpi" src="res/android/ldpi.png" />
        <icon density="mdpi" src="res/android/mdpi.png" />
        <icon density="hdpi" src="res/android/hdpi.png" />
        <icon density="xhdpi" src="res/android/xhdpi.png" />
        <icon density="xxhdpi" src="res/android/xxhdpi.png" />
        <icon density="xxxhdpi" src="res/android/xxxhdpi.png" />
        <splash density="land-hdpi" src="res/android/splash-land-hdpi.png" />
        <splash density="land-ldpi" src="res/android/splash-land-ldpi.png" />
        <splash density="land-mdpi" src="res/android/splash-land-mdpi.png" />
        <splash density="land-xhdpi" src="res/android/splash-land-xhdpi.png" />
        <splash density="port-hdpi" src="res/android/splash-port-hdpi.png" />
        <splash density="port-ldpi" src="res/android/splash-port-ldpi.png" />
        <splash density="port-mdpi" src="res/android/splash-port-mdpi.png" />
        <splash density="port-xhdpi" src="res/android/splash-port-xhdpi.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="20" src="res/ios/icon-20x20@1x.png" width="20" />
        <icon height="40" src="res/ios/icon-20x20@2x.png" width="40" />
        <icon height="60" src="res/ios/icon-20x20@3x.png" width="60" />
        <icon height="29" src="res/ios/icon-29x29@1x.png" width="29" />
        <icon height="58" src="res/ios/icon-29x29@2x.png" width="58" />
        <icon height="87" src="res/ios/icon-29x29@3x.png" width="87" />
        <icon height="180" src="res/ios/icon-60x60@3x.png" width="180" />
        <icon height="120" src="res/ios/icon-60x60@2x.png" width="120" />
        <icon height="76" src="res/ios/icon-76x76@1x.png" width="76" />
        <icon height="152" src="res/ios/icon-76x76@2x.png" width="152" />
        <icon height="80" src="res/ios/icon-40x40@2x.png" width="80" />
        <icon height="120" src="res/ios/icon-40x40@3x.png" width="120" />
        <icon height="167" src="res/ios/icon-83.5@2x.png" width="167" />
        <splash height="480" src="res/ios/Default~iphone.png" width="320" />
        <splash height="960" src="res/ios/Default@2x~iphone.png" width="640" />
        <splash height="1024" src="res/ios/Default-Portrait~ipad.png" width="768" />
        <splash height="2048" src="res/ios/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="768" src="res/ios/Default-Landscape~ipad.png" width="1024" />
        <splash height="1536" src="res/ios/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="1136" src="res/ios/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="res/ios/Default-667h.png" width="750" />
        <splash height="2208" src="res/ios/Default-736h.png" width="1242" />
        <splash height="1242" src="res/ios/Default-Landscape-736h.png" width="2208" />
        <splash height="2436" src="res/ios/Default-2436h.png" width="1125" />
        <splash height="1125" src="res/ios/Default-Landscape-2436h.png" width="2436" />
    </platform>
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <plugin name="cordova-plugin-splashscreen" spec="~5.0.2" />
    <plugin name="cordova-plugin-dialogs" spec="~2.0.1" />
    <plugin name="cordova-plugin-network-information" spec="~2.0.1" />
    <plugin name="cordova-plugin-inappbrowser" spec="~3.0.0" />
</widget>

如果可以运行,则小部件应该能够在Android应用程序中流式传输互联网广播。现在,它仅在浏览器中可用。

0 个答案:

没有答案