Ionic - no internet connection

后端 未结 1 1184
北恋
北恋 2021-01-15 00:09

We are building a android application using Ionic (+Cordova).

It all works in my browser, but when I build it and run the .apk this happens:

External images

相关标签:
1条回答
  • 2021-01-15 00:39

    Check your manifest to allow your app to use internet.

    <uses-permission android:name="android.permission.INTERNET" /> 
    

    If you are using cordova 5 (Android platform version 4.0.0) then you should include the whitelist plugin and also the new content security policy meta tag to allow google maps api to load like this (on the top of your html file along with the rest meta tags):

    <meta http-equiv="Content-Security-Policy" content="default-src *;
     style-src 'self' 'unsafe-inline' http://fonts.googleapis.com/;
    script-src 'self' 'unsafe-inline' 'unsafe-eval' http://*.googleapis.com
     http://maps.gstatic.com;">
    

    EDIT: Check also your config.xml what access you give:

    <access origin="*" />
    

    for instance to allow all connections

    If it doesn't work please check your logs and post any errors.

    0 讨论(0)
提交回复
热议问题