Как включить сетевые запросы в приложении Android Cordova - PullRequest
0 голосов
/ 31 мая 2019

У меня есть виджет Radiojar в приложении Cordova, которое транслирует интернет-радио.Когда я запускаю приложение в браузере, виджет работает нормально, но когда я запускаю его на устройстве / эмуляторе 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.Сейчас он работает только в браузере.

...