cherouvim
cherouvim

Reputation: 31903

why does a very simple phonegap app use mobile data plan?

I've created a very simple mobile app with phonegap which doesn't do anything network related. All resources (images, css, etc) are local and I don't do any ajax calls to a remote server. But when I check the mobile data screen on my phone, I see that it has used some data. See screenshot bellow (4th app called "cherouvim phonegap test"). It says 308KB and that was in 5 hours.

enter image description here

Clicking on that gives me the following breakdown:

html:

<!DOCTYPE html> 
<html> 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta name="viewport" content="user-scalable=no, width=device-width" /> 
    <script type="text/javascript" src="phonegap.js"></script>
</head>
<body>
    ...
</body>
</html>

I build with phonegap build and my config.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns     = "http://www.w3.org/ns/widgets"
    xmlns:gap = "http://phonegap.com/ns/1.0"
    id        = "cherouvim.test"
    version   = "1.0.0">

    <name>cherouvim phonegap test</name>
    <description>...</description>

    <preference name="phonegap-version" value="3.5.0" />
    <preference name="android-installLocation" value="auto" />
    <preference name="orientation" value="portrait" />
    <preference name="fullscreen" value="true" />

    <gap:plugin name="org.apache.cordova.media" />

    <feature name="http://api.phonegap.com/1.0/network" />
    <access origin="*" />

    <gap:platform name="android" />

</widget>

In the documentation it says:

<!-- If you do not want any permissions to be added to your app, add the
    following tag to your config.xml; you will still have the INTERNET
    permission on your app, which PhoneGap requires. -->
<preference name="permissions" value="none"/>

Is this a hint that Phonegap actually does something network related behind the scenes?

Edit: In case it matters I'm using nexus 5 (android 4.4.4) and I've enabled the "developer mode" and the ART runtime.

Upvotes: 4

Views: 329

Answers (1)

cherouvim
cherouvim

Reputation: 31903

Building the app in phonegap build with the "enable debugging" option set injects the following just before </body>.

<script type="text/javascript" src="http://debug.build.phonegap.com/target/target-script-min.js#35fd7e24-189a-11e4-8c3c-e63707b18140"></script>

This is used for the weinre remote debugger of phonegap build.

Building without the "enable debugging" option doesn't inject this remote script. So, an app built for production use wouldn't actually use any mobile data as I initially thought it would.

Upvotes: 1

Related Questions