I have used WebView
for browsing in my application, now i want to get internet usage by my WebView
. Is it possible in android?
I have searched a lot but not getting even a single hint. Can anyone help me?
I know you will ask me what have you tried so far
, but i didn't get anything from research. If anyone can give me hint, i am not asking for full code or example.
I have created simple webview and its working fine
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
If you use an Android device, you can add the Google Fi widget to your home screen to have your data usage on hand at all times. Go to the Account tab. At the top of the screen, you'll see your current data usage. Android: To see your daily breakdown select View overall or Daily data usage.
Check Data Usage in Settings Check to see which apps are using data. On many newer Android devices, you can go to “Settings” > “Data Usage” > “Cellular data usage“, then scroll down to see which apps are using the most data.
Several factors contribute to high usage, but much of it comes down to frequent activity. If you have devices such as computers, tablets, smartphones or security cameras that are constantly running, it's likely your usage numbers will be high.
There is no means for you to determine the bandwidth consumed just by your WebView
.
Depending on how your app is written, if you can determine how much bandwidth you are using outside of WebView
, you can use TrafficStats
to determine your whole app's bandwidth uses, and then subtract the two values to determine what is inside the WebView
.
Webview essentially is a DOM Tree which renders objects. It parses your HTML tags , creates elements and helps draw objects on a webpage. All the request for download goes as an http/https etc. request to android framework services. The webview does not know how much of data has been downloaded. It only requests for data and receives the contents/response back.
You should look into the code of Data usage activity/fragment in Settings applications. This will tell you how it monitors and tracks data of various applications but there is no suupport present in the framework(yet) to know which webview has downloaded how much content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With