Network usage : How to monitor by time


Question

I'm looking for a way that tracks network usage by type. I'd like something that at the end of the day says "8h 20min on 3G, 3h under WiFi network".



I've searched a lot but didn't find anything (there are tons of apps that tracks megabytes exchanged, but this is not my interest).



Is there a technical problem behind (i.e. lack of system APIs)?


Answer

I don't think there is a technical difficulty in gathering such information. Lack of such apps is likely because of lack of demand. For an average user, it is not the time that is important but the data used while on a plan or roaming and hence an abundance of such apps



I am not aware if the information you seek can be pulled from Android OS requiring programming skill . There is an open source app Network Monitor, which can help you. It doesn't directly give you what you want, but information can easily be extracted. App has been updated last month. Extract from app description:




Network Monitor is a diagnostic tool which periodically tests your network connection and logs the results to a database on the phone....It also logs other information about your device and connection status, such as:
The network type (WiFi, mobile/EDGE, mobile/HSPA, etc)




It offers a rich selection of features to log and display. This solution shows minimum settings required to achieve your goal :




  • Network Settings → Enable Service ( Enable / disable as required per duration of monitoring)


  • Network Settings → Log frequency can be varied from 1/2 sec to 1 hour , depending on the accuracy you need


  • Advanced Options → Fields to monitor - offers 50 + fields. Basic fields needed would be :




    • Timestamp


    • Network Type


    • Is connected





You can view the log file with these settings as shown in the screenshot below



enter image description here
enter image description here



Log file can be exported ( mail it yourself) in several formats (Excel, CSV, HTML, KML, Gnuplot the raw database) , for further analysis. Excel would be the obvious choice.




  • You can filter the Network Type and Is connected =1 ( to avoid disconnected times ), say for WiFi


  • Use the count function of Excel and multiply it with log frequency ( i.e, time) to arrive at total time and convert it to hh:mm format - my Excel is rusty, there should be better ways :)


  • Repeat for mobile data



Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes