Javascript 在Phonegap/cordova Android应用程序中,使用内容安全策略连接REST API的正确方式是什么

Javascript 在Phonegap/cordova Android应用程序中,使用内容安全策略连接REST API的正确方式是什么,javascript,android,cordova,content-security-policy,Javascript,Android,Cordova,Content Security Policy,我已经成功开发了一个Phonegap混合应用程序,它在模拟器上运行良好,但在安卓设备上安装时无法发布到远程服务器。我配置了白名单插件,我的config.xml包含 <plugin name="cordova-plugin-whitelist" version="1" /> <access origin="*"/> <allow-navigation href="http://*/*"/> <allow-intent href="http://*

我已经成功开发了一个Phonegap混合应用程序,它在模拟器上运行良好,但在安卓设备上安装时无法发布到远程服务器。我配置了白名单插件,我的config.xml包含

 <plugin name="cordova-plugin-whitelist" version="1" />   
 <access origin="*"/>
<allow-navigation href="http://*/*"/>
<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:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>

我的索引页包含

 <meta http-equiv="Content-Security-Policy" content="default-src 'self' gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src *; connect-src *">

我正在使用Cordova 5.3.3 但似乎什么都不管用

谁能告诉我我做错了什么。 谢谢

尝试以下方法

    <plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <access origin="*" />

    <preference name="permissions" value="none"/>

我在问题中发布的白名单配置和内容安全策略是正确的,足以让android平台上部署的混合应用程序连接到远程API

问题在于API本身,因为该应用程序与其他API连接良好。最初,我们使用一个play框架来开发API,它在响应混合应用程序上的客户端请求时遇到一些问题

然后,我们创建一个PHP代理脚本,该脚本从客户端获取请求并将其传递给play服务器

就是这样

请在你的帖子中回答以下问题。因为这似乎是你关于这个主题的第一篇文章。这是你的第一款混合应用程序吗?你的目标平台和目标版本是什么:安卓4、5、6?iOS 7,8,9?你在哪个平台上开发?Windows,MacOS?你在用什么?请不要假设答案,请阅读链接。一旦你在帖子中回答了问题,在评论中回复,这样我知道你已经在帖子中添加了信息。