Enabling internet permissions in a Cordova/Ionic app

Published October 30, 2016

If you try running a Cordova/Ionic app with few plugins, you'll probably be very confused when you try to create an HTTP request. It'll work fine in the browser, but on a device it'll fail.

If you hook it up to the Chrome developer tools and inspect the webview, it'll show Status: (failed) and Type: Pending.

The answer to this is that you need to ask for access to network permissions.

How your permissions might lookHow your permissions should look

It seems like you should be able to define your app's permissions in the config.xml file, but this doesn't seem to be the case. However, plugins can declare permissions in their plugin.xml file.

So, I created a plugin which does nothing else than defines a plugin.xml which asks for network permissions.

To install it, use:

cordova plugin add https://github.com/markwatkinson/cordova-plugin-internet-permissions.git

Filed under: programming, technology, ionic, cordova, phonegap

Talk is cheap

Leave a comment:

HTML is not valid. Use:
[url=http://www.google.com]Google[/url] [b]bold[/b] [i]italics[/i] [u]underline[/u] [code]code[/code]
'