androidbrowser

How to calculate website speed in Android


How can I calculate the website speed in Android, in other words how soon it will open up in browser. I also wish to calculate all the statistics of that particular page e.g. total bytes or connection time etc.


Solution

  • You could:

    1. save the current timestamp,
    2. make a http request,
    3. get the http response,
    4. and get the timestamp as soon as your response arrives and calculate the difference in time.

    Or, you could

    1. Create a WebView
    2. Set a WebViewClient
    3. Use its callbacks - onPageLoaded, onPageFinished, onPageStarted, etc ...

    Check here: http://developer.android.com/reference/android/webkit/WebViewClient.html