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
- Open-source software.
- Network traffic counter for both EDGE/3G and Wi-Fi.
- Available in English, German, Czech, Italian, French, Russian, Spanish and more.
- Data are persisted.
- Dynamic counters that can be added, modified and removed. "Total", "Last 30 days", "Last 7 days", "Today", "Yesterday", "Weekly", "Monthly" and more are available.
- Alerts on a counter basis if limit exceeded.
- Starts automatically if you restart your phone.
- Export/Import data to/from the SD card (CSV format).
ChangeLog
v0.14.1 (2010-05-21)
- Fixed crash (ArrayIndexOutOfBoundsException) with Swedish locale. Thanks to Fredrik Premler and risbert.
v0.14 (2010-05-21)
- Improved Dutch translation. Thanks to Bram Schoenmakers.
- Updated Swedish translation. Thanks to Tibor Baranyi.
- Network interfaces should be automatically discovered now. Should work for most devices. Contact me if yours does not. Thanks to everyone who submitted a patch to support their devices (Matti, Jon, Tristan, Samuel, Bram, Marco, Thilo and many others).
v0.13.1 (2009-12-22)
- Hopefully fixed CSV export issue on newer version of the SDK.
v0.13 (2009-12-22)
- Added support for Samsung I5700 (Spica). Thanks to everyone who provided the required informations.
- Added support for Google Nexus One (passion).
- Updated Catalan translation. Thanks to Joan Montané.
- Added Swedish translation. Thanks to Tibor Baranyi.
- Added "last month" counter as per users request.
v0.12.2 (2009-11-11)
- Motorola Droid support. Thanks to everyone who provided the required informations.
v0.12.1 (2009-11-03)
- Accept all screen resolutions. Should work on HTC Tattoo.
- Switched to SDK 1.6 (4) but minimal requirement is still SDK 1.5 (3).
v0.12 (2009-09-17)
- NetCounter now requires Android 1.5. SDK version 3.
- Added BarGraphActivity. Uses a modified version of AChartEngine (Apache 2 license). This is still experimental.
- Added debug option. Show some debug information in the notification area.
- Added Russian translation. Thanks to Dmitry Kutsenko.
- Hopefully fixed the negative value bug. Thanks to Erwin Betschart and Stavros Kafouros.
- Added aTrackDog support.
- Added What's New dialog on first start of a new release/new install.
- Added support for T-Mobile Pulse (Huawei U8220).
- Many bug fixes and improvements.
show/hide
TODO
This is a list of planned features for the future releases.
"Monthly" counter with user-defined date.- Alert/notification if counter exceeds a given limit. (partially done)
Refactor, clean-up the code and synchronize the threads correctly.Make NetCounter open-source.Export data and also (probably) import.Add preferences (notifications, update rate, etc).- Reorder counters.
Download
If you do not have access to the Android Market, you can still download and install NetCounter from here.
- netcounter-0.14 sha1sum: a10e8e9c62ed1d14699be05deb274d504c056938
- netcounter-0.14 sha1sum: 865215c65310d0906c3fb36519b6c53a80c9e554
- netcounter-0.13.1 sha1sum: 01131494152555c1b313c05824b660610eb81720
- netcounter-0.13 sha1sum: c4b920042d8008563b5c511058d8a4a7cada14af
- netcounter-0.12.2 sha1sum: f976e21abc8537a6521f4dcf8c37fe765239f962
- netcounter-0.12.1 sha1sum: becdfdc8574f0ba60c3879cc51a819695929e951
- netcounter-0.12 sha1sum: fe002f59973feb57ec0ecc949d4fff53154f1247
- netcounter-0.11.1 sha1sum: eb269e03e782ea1cd97528222f3b3ccdab5d9fc4
- netcounter-0.10 sha1sum: cc5aec5fa886dc7d1f6874a3abd5c1a137f31247
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:
- Do a last export (if needed).
- Reset all the data of the interface you want to import. Long-click on the interface item in the main screen to do this.
- Import the data.
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