Introduction

NetCounter is a network traffic counter for the Android platform. As a big Unix/Linux fan, I like the K.I.S.S. principle. So this application will not integrate tons of features but will (try) to display your network traffic consumption in a simple and nice manner.

I wrote this application because I need it. I have only 250 MB included in my contract so I have to take care of my bandwidth usage. As Android does not include such a counter, I decided to write a simple application which will show me my current bandwidth usage.

This is my first Android application. I still have a lot of things to learn about Android and I will improve and fix bugs in NetCounter as I am getting more familiar with the framework.

NetCounter is an open-source application released under the GPLv3 license. This application is free and will remain free so if you really like it, please consider donating.

Features

ChangeLog

v0.14.1 (2010-05-21)

v0.14 (2010-05-21)

v0.13.1 (2009-12-22)

v0.13 (2009-12-22)

v0.12.2 (2009-11-11)

v0.12.1 (2009-11-03)

v0.12 (2009-09-17)

show/hide

TODO

This is a list of planned features for the future releases.

Download

If you do not have access to the Android Market, you can still download and install NetCounter from here.

Getting the source

NetCounter is an open-source software available under the GPLv3 license. You can get the code from my Subversion repository. Feel free to look at it and submit patches if you find bugs or want to improve something.

To get the latest version, use:

svn co https://www.jaqpot.net/svn/android/netcounter/trunk netcounter

I strongly recommend that you check out the project using Eclipse as it is already configured for it.

FAQ

I see/saw negative values. What should I do?

You should first upgrade to 0.12. The bug should be fixed in this release. It happened when the underlying statistics overflowed and started again at 0. This is the case if you download/upload a lot (at around 2GB I think). However, if you encounter this bug in the past, your database probably contains wrong values. To check/fix it, use the export function and verify that there are no negative values in the file. If you find one or more, edit the file (make a copy first) and replace the negative values with correct ones (you will have to find, guess or imagine them. Sorry...). Save the file. Reset all the data of the affected interface(s) and use the import function to import the values again. That's it.

What are those netcounter-xxxxxx.csv files on my SD card?

When you click on "Export to .csv" (in the advanced preferences), NetCounter dumps the whole database into a file. The comma-separated values file is written at the root of the sdcard and can be opened with a text editor or any spreadsheet software like OpenOffice.org Calc and generate graphs. The interface names "rmnet0" and "tiwlan0" correspond respectively to EDGE/3G and Wi-Fi. Those names can be different on your mobile phone. The "rx" and "tx" values are bytes. The filename contains the Unix time of the export.

Can I also import those netcounter-xxxxx.csv files?

Yes, since 0.11. NetCounter will automatically import the exported files created with the export function. NetCounter does not overwrite values already present in the database. So the recommended procedure is:

Since the export files are complete dumps of the database, you can keep only the last one that is complete. This will speed-up the import process a lot.

NetCounter runs in the background. Will it drain my battery faster?

No and yes. Let me explain why. Yes because every time an application runs, it needs some power. No because NetCounter uses the AlarmManager in order to be woken up when needed. The rest of the time, NetCounter does nothing in the background. When woken up, NetCounter acquires a WAKE_LOCK for the small amount of time (a hundred milliseconds) needed to update its database. This operation is performed once every hour while on 3G/EDGE and every 30 seconds while on WiFi. So NetCounter should have an insignificant impact on battery life.

Notifications/alerts only appear/disappear after a long time. What's happening?

First of all, notifications/alerts are in a beta stage and thus may be buggy. As explain above, NetCounter only wake up once an hour when in background in order to save power. Notifications/alerts get evaluated at this time so currently it is possible that notifications "lag" a bit.

What is the WiFi slow update rate option?

When WiFi is on, NetCounter updates its database every 30 seconds. When WiFi is turned off, Android unloads the driver and all the statistics are gone. The only reliable way to not lose these data is to poll regularly for them. But this also means more power consumption. If WiFi statistics are not relevant to you, you can enable the WiFi slow update rate option.

NetCounter needs the WAKE_LOCK permission. Will it drain my battery faster?

Please see above.

How accurate is NetCounter?

As much as it can without impacting user experience too much. There are many problem here. First, Android does not provide any API to get network statistics. So all the data are gathered from the underlying Linux system. Driver loading/unloading reset the statistics and powering off the phone too. Neither of these events are communicated to Android applications. The only way to get reliable statistics is to poll for them. If you poll frequently, the data will be more accurate but your battery will be emptied pretty fast. So it is a trade-off between accuracy and power consumption. Second, your provider may count data in a different manner than NetCounter does (e.g. accounting at least 400kB for every session).

Can I improve the accuracy of NetCounter?

I suggest you quickly start NetCounter just before powering for phone off or just before you switch WiFi off. So you will see your data consumption and NetCounter will record the latest statistics.

Does NetCounter access the Internet in the background?

No. NetCounter does not perform any network operations.

Screenshots

Main screen. Long click on an interface item to add a new counter or reset the data.
Long click on a counter item to change its type or remove it. Click on a counter item to see more details.
Select the type of a counter. Set the start date of your data plan for the monthly counter.

Contact

If you have some suggestions, bug reports or questions, you can contact me at netcounter@jaqpot.net. Please, remember that I will not add too many additional features in order to keep NetCounter simple.

Donation

If you like this application, you can donate money using PayPal. I would really appreciate it.

Copyright 2009-2010 Cyril Jaquier