đ Network Tools
To work with network and usagePreviously NetworkUsage. With NetworkTools, you can get the data usage and packets of Wifi, Mobile data. Also, you can monitor or view the current data traffic as formatted ( 1.5Mbps etc.,. ) or you can calculate them by logic or parse it yourself. I documented the blocks and usages of them. From v1.6, you can get usage and packets of a specific app by itâs package name.
đ§©
Blocks
General
Doesnât require any permissions ( and Usage Access too )
download ~ number - float ( or string if formatted )
upload ~ number - float ( or string if formatted )
This event is triggered when the Traffic changes ( Doesnât consume data to determine usage ). This shows the current data transfer speed of the system.
Note : You need to initialize it first
type ~ Data type ( Property )
Use this to initialize TrafficMeasurer and start it ( has event ).
Can be used to Pause, Resume, Stop the background thread ( TrafficChanged event ).
Note : You canât use this blocks before Initializing. If used, will throw error
type ~ Data type ( Property )
Can be used to get the amount of Packets Uploaded/Downloaded.
type ~ Data type ( Property )
formatted ~ boolean
You can use this method blocks to return the amount of data used.
Formatted value returns formatted string value ( 1.5GB etc., )
Note : Use ReturnBits property if you want to return bits instead of bytes
bytes ~ string ( double )
useBits ~ boolean
Takes only bytes as input ( not bits ). But, you can then convert it to bits if you want. Eg. If you input 1 byte with useBits as true. It will return 8 b.
App Specific
Requires USAGE ACCESS PERMISSION
package Name ~ string
upload ~ number ( string if formatted )
download ~ number ( string if formatted )
uploadPackets ~ int
downoadPackets ~ int
Note : Use ReturnBits property if you want to return bits instead of bytes
package Name ~ string
Fired when the package provided isnât installed/not found.
Returns true if app has Usage Access Permission Granted
Use ths block to open the settings if Usage Access Permission is not Granted
package Name ~ string ( Will fire Package Not Found if any error occurs )
formatted ~ boolean
type ~ Data type ( Property )
Will fire GotPackageStats if succeeds.
Note :
DataAll will be used if Android version is below Marshmallow ( sdk 23 )
DataWifi will be used if Android version is above Q ( sdk 29 )
This restrictions are made due to api changes ( sdk 23 ) and privacy reasons ( sdk 29 )
Use ReturnBits property if you want to return bits instead of bytes
Property Blocks
Type ~ boolean
Determines whether the output of current traffic is formatted ( Human readable, 1.5Mbps etc., ).
Type ~ boolean
Determines whether the data is returned as either Bytes or Bits. If you set formatted too⊠The formatted data will be Kilobits, Megabits, Gigabits
instead of Kilobytes, Megabytes and Gigabytes.
1 Byte = 8 Bits ( So, the data output may vary by a large difference )
Type ~ boolean
To get usage of a particular Data Source ( Can be used in DataMeasure, GetDownload, GetUploaded, GetDownloadPackets, GetUploadPackets )
Test App Screenshots
đ
Downloads
Whatâs new in v1.6 :-
- Get usage by package
- Uses
READ_PHONE_STATE
,PACKAGE_USAGE_STATS
,QUERY_ALL_PACKAGES
permissions - Added DataWifi property to get Wifi usage separately
- Fixed minor bugs/errors
Files
Extension ( v1.6 ) :com.jaxparrow.networkusage.aix (19.5 KB)
Test Apk : Network_Tools.apk (5.4 MB)
Test Aia : Network_Tools.aia (38.8 KB)
Older Versions
Check Github Releases for releases after v1.0
v1.0 ( Appybuilder IDE )
Aix :com.appybuilder.jackandrichardjunior.Networkstats.aix (5.9 KB)
Test App : NetworkStatsTest.apk (5.2 MB)
âčïž
Open-source and credits
@Taifun for their TaifunPM extension ( used in Test Apk )
Now, rebuilt with Rush.
This extension is now open-sourced and you can contribute to this extension by forking and creating a pull request.
Code snippets from internet ( stackoverflow )
Network Traffic Measuring : https://stackoverflow.com/a/53539175/13639399
Get Usage by Package : https://stackoverflow.com/a/29084035/13639399