美文网首页
Ionic 添加请求Android 权限

Ionic 添加请求Android 权限

作者: SuperCoderMan | 来源:发表于2019-07-10 09:39 被阅读0次

问题

  • 打包加上--prod 发现在Android手机上http请求一直失败。

解决过程

最终解决方法

  • step1 修改config.xml 的widget 标签,注意id的value替换成自己的
<widget id="io.ionic.configEdit" 
        version="0.0.1" xmlns="http://www.w3.org/ns/widgets" 
        xmlns:cdv="http://cordova.apache.org/ns/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android">
  • step2 添加Android要求的权限
    <platform name="android">
        <config-file parent="/manifest" target="AndroidManifest.xml">
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.NETWORK_ACCESS" />
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        </config-file>
                  ......
    </platform>

相关文章

网友评论

      本文标题:Ionic 添加请求Android 权限

      本文链接:https://www.haomeiwen.com/subject/qocckctx.html