- Check network speed android
- Speedcheck 5.2.3.7
- Local network speed test for Android
- How it works
- Speed test between Android based devices
- Speed test between Android based device and your computer
- Samba share test
- Classic speed test
- Stability/Walking test
- Implementing Internet Connectivity Checker in Android Apps
- Enough talk!
- Back to our business
- That’s it!
- Designing Android apps to handle slow network speed
- Why it might be important to you
- In Android, there are ways to determine your connection speed
- Using NetworkInfo class, ConnectivityManager and TelephonyManager to determine your network type
- Download some file from the internet & calculate how long it took vs number of bytes in the file
- A sample code below which shows each of those steps
- Use Facebook’s Network Connection Class library
- Handling edge cases
Check network speed android
Краткое описание:
Вы можете отслеживать скорость вашей сети в режиме реального времени
Network Speed — небольшой, быстрый и бесплатный сетевой инструмент. Вы можете отслеживать скорость вашей сети в режиме реального времени и мгновенно показывать точную информацию в фоновом режиме.
Вы никогда не задумывались, почему ваша веб-страница загружается медленно или вы ищете измеритель скорости интернета для мониторинга? Теперь вы можете проверить скорость вашей сети с помощью текущего уведомления или плавающего виджета, чтобы сразу увидеть статистику в реальном времени.
Скорость сети — Основные характеристики ����
★ скорость интернета в реальном времени
★ Статистика использования приложения
★ Монитор сетевых подключений (netstat)
★ Статистика использования приложения
★ много вариантов настройки
★ Отслеживать и контролировать ежедневные данные и использование WiFi из уведомления
★ Эффективное использование батареи и памяти
Особенности:
★ Подробная ежедневная статистика использования данных
★ Скачать и загрузить график скорости
★ Ежедневное использование трафика в уведомлении
★ Мониторинг ваших данных трафика за последние 30 дней
★ Показать результат пинга на плавающем виджете
★ Скрыть, когда не подключен к какой-либо сети
★ Точный мониторинг использования данных
★ Предупреждение об использовании данных (мониторинг пропускной способности)
★ Совместим со всеми типами сетей (3G, 4G, 5G и LTE, WiFi, VPN)
и больше! Скачать сейчас и испытать это самостоятельно
Возможность показа по адресу:
— Панель уведомлений
— Плавающий виджет
— Быстрые настройки
— Сбой или возникли проблемы? Напишите нам, чтобы решить
Руководство: https://blog.evozi.com…-get-logcat-crash-log/
Также известен как:
— Индикатор скорости сети
— измеритель скорости интернета
— Уведомление о скорости сети
— Строка состояния измерителя скорости
— Интернет-монитор скорости
— Скорость WiFi в строке состояния
Требуется Android: 4.1 и выше
Русский интерфейс: Да
Источник
Speedcheck 5.2.3.7
Speedcheck — это полезный и многофункциональный инструмент, который поможет не только протестировать скорость интернета, но и найти точки WiFi.
Если у вас возникли сомнения касаемо вашего пакета или качества интернет-покрытия в вашем городе, то Speedcheck постарается их развеять или подтвердить. С помощью Speedcheck вы сможете измерить скорость как WiFi, так и мобильного интернета. Также в этом приложении есть удобный поисковик, который поможет вам найти WiFi точки доступа. Как насчет альтруизма? Измеряйте скорость интернета в кафе, ресторанах, отелях, парках и других общественных местах, добавляйте результаты в общую базу и проинформируйте всех пользователей.
Всю имеющуюся информацию об интернет-покрытии вы сможете просмотреть на официальном сайте приложения или же через любую поисковую систему. В Speedcheck вы можете измерить скорость отдачи, скачивания и пинг, что весьма важно для любителей серфить по интернету или играть в онлайновые игры.
Особенности приложения Speedcheck:
- Измерение скорость интернета и пинга;
- Поиск точек доступа WiFi;
- Стильный дизайн.
Источник
Local network speed test for Android
*** THIS CONTENT IS ALREADY OBSOLETED
A few weeks ago, I just wanted to test the speed of my local network between my Android based mobile and my computer due to slow file transfer problem.
Unfortunately, I was not able to find any useful LAN speed test application, however there were a lot of Internet speed test applications (but they can’t test the speed of the local network).
This problem inspired me to write an easy LAN speed test application. You can find it on the Android Market: Local WiFi Speed Test
You can test the speed of your WiFi/LAN between your mobile devices, or between a mobile device and your computer. Also because my original problem was caused by slowness of a Samba share, I added a possibility to test Samba speed between your mobile and a computer.
How it works
First of all, the application always displays the current SSID of the connected WiFi network, the current signal strength level (in dBm) and the current link level, so you can use it any time to check these values without starting the test.
Here is a video about my application:
Speed test between Android based devices
- Install the above application to your mobile devices.
- Select Server mode on one of them and click on Start: it will display a progress bar and wait for an incoming connection
- Select Client mode on the other device, add the hostname and port displayed by the server and click on Start. You can follow the speed changes on the speedometer. The progress bar displays the current position of the transferred data.
- You can stop the test any time. If the status becomes “failed” it means some network issue happened.
Settings:
- On Settings/Target settings you can set the default IP address/host name and the port number. They are loaded when the program starts.
- On Settings/Transfer settings you can set the transferred data size (1, 10, 100 MB or limitless) and the message block size.
- On Settings, you can switch between megabyte/kilobyte and megabit/kilobit
Speed test between Android based device and your computer
Samba share test
- Select SMB client on your mobile, and add the samba share path to host field in the next form: myhost/shared-folder, or username:password@myhost/shared-folder
- Click on Start: you can follow the same results as in the first case.
Classic speed test
For this test, you may need to install an external program to your computer. This program will simulate the server.
- If you are running Linux, you can use netcat command on that way: nc -l(p) PORT > /dev/null
- If you are running Windows or you don’t want to use the netcat command, you can download my tcpserver program written in python. You can download it from here: https://bitbucket.org/pzolee/tcpserver/downloads/tcpserver.py
- After downloading, you can run it with the next command: python tcpserver.py -o nul PORT (to start it you need an installed Python framework: python.org). I didn’t want to offer a compiled .exe program, because perhaps you wouldn’t trust in it.
- Select Client mode on your mobile, give the hostname/IP address of your computer and the PORT.
- Click on Start and check the results.
Stability/Walking test
- Go to Settings/Transfer settings and select “limitless”.
- Now you can choose one from the above test types and run the test until you stop it.
- Because there is no limit, the test will run forever, and you can check if your network is stable during a longer period, or just walk in your house or garden and discover the speed changes. If there is any network issues the test will hang and the status will change to “failed”.
Finally, here are a few pictures about the program:
Источник
Implementing Internet Connectivity Checker in Android Apps
Dec 31, 2020 · 4 min read
W orking on an Android chat app? social media app? or any other internet-based app that you want to check if there is an internet connection in order to continue a process or even notify the user about their network state? This guide comes to the rescue!
You may say: “ Hey! There is already an API which gets this job done.”
Yes, there is! Well, although Android SD K provides API that you can use to get network state of user’s device like ConnectivityManager, it does not actually check whether there is an active internet connection. Concretely, try establishing a hotspot from mobile device “A” but do not turn on mobile data or WiFi, then connect mobile device “B” to that hotspot of “A”.
Using device “B”, when you try to search, say, on Google this won’t work as there is no internet connection although you are connected to a network. ConnectivityManager APIs work the same. They just tell whether you are connected to a network or not — regardless of having an active internet connection or not.
So, the bottom line is:
“How do we check if there is an active internet connection?”
Basically, we can ping or connect to any server to see whether this ping or connection is successful or not.
If you have your own back-end server, you may prefer to try to connect your app to the server to make sure that the device has an internet connection and your server is not down at the same time.
We can also connect to Google’s servers as they are unlikely to be down (or for a long time).
To optimize our class implementation (we’ll call it NetworkConnectivity), it’s good to check a device’s network connection using ConnectivityManager so that if WiFi or mobile data is turned off or even WiFi is turned on but there is no network the device is connected to, we don’t have to make requests to any servers.
Enough talk!
First of all, add internet and network state permissions in your app manifest:
Now, create a function to check network availability using ConnectivityManager:
Here we used getAllNetworkInfo() to return an array of objects of all networks and then we check whether any of them is connected.
But this method is deprecated since API 23. For later APIs, we used getAllNetworks() which is added in API 21. But yea, getNetworkInfo() is also deprecated since API 29 🙂
Back to our business
To ping Google’s server, basically, we can do that with a few lines of code:
This approach works synchronously so that you just wait for the response to tell whether you have a connection or not and it takes no time. However, in some mobile devices for specific brands, the framework does not allow performing this process in Runtime, so you can not eventually rely on it.
Instead, we can make a normal HTTP connection request to the server.
Start by creating a method called checkInternetConnection which checks first if WiFi or mobile data are connected to any network by using the above method. Then it starts establishing an HTTP URL connection:
ConnectivityCallback is an inner interface having an abstract function which we’ll use to communicate with our UI classes when the server’s response comes back.
In the above checkInternetConnection function we used: “ http://clients3.google.com/generate_204” instead of Google’s normal URL “ http://www.google.com” since the first is a bit more efficient so that we don’t have to grab the whole web page.
For a successful request, the response code must be equals to 204 and no content is returned back.
We used “ setRequestProperty()” to set headers (some information the server needs to know) for the request for the server. Also, we specified the connection timeout to be one second which is a reasonable time.
But wait! Android framework does not allow network operations on the main thread so we need to use the above code on another thread. Consequently, we’ll have to post the result on the main thread again. You can use whatever is convenience for you to perform both of these operations. I would use a singleton AppExecutors class which provides executor threads for both of our cases.
postCallback() is a helper method that posts our result to the interface on the main thread.
That’s it!
To check internet connectivity in an activity:
In recent devices, Android may produce a security exception due to using HTTP URL connection. To fix this, add android:usesCleartextTraffic=”true” in your app manifest within application tag or use HTTPS instead of HTTP connections. So, pay attention to exception handling in your checkInternetConnection method.
Источник
Designing Android apps to handle slow network speed
Jan 23, 2017 · 5 min read
Developing your Android app to handle slow network speed is an important task to consider.
Why it might be important to you
There are many reasons why an Android developer should care about this
- The reality is that most developers only test their app on fast WiFi connections within their location or development area.
- Different networks around the world have different properties, we often forget that our devices are not connected to high speed internet 24/7, most especially if you are building an app that cuts across several countries and regions.
- App crashing when network drops in the middle of a remote call or perhaps if network changes while user is downloading something within the app.
It is always good to handle slow connection to give users a great experience while using your app regardless of the locale or network.
Sometimes, your app might be responding slowly be c ause your users are only paying for slow internet, users don’t usually care if network is bad, they end up cursing the app and uninstalling it, then leave a bad rating on the Play store even for their own poor internet connection.
Its best to design your app to handle the lack of network connection, provide a friendly feedback to the user and never show user a raw error message. Feedbacks can be attention grabbing alert dialogs, toast message or a simple friendly snack bar message.
A good popular practice is to Structure or Design your app to use a cache mechanism. Determine network speed when the app starts, based on that, you can display images with lower quality and others. Avoid multiple calls to the server, get all the data in one go and then use the cache, moving forward request your data from the cache.
In Android, there are ways to determine your connection speed
- Using NetworkInfo class, ConnectivityManager and TelephonyManager to determine your network type.
- Another test is to download some file from the internet & calculate how long it took vs number of bytes in the file.
- Use Facebook’s Network Connection Class library to figure out the quality of the current user’s internet connection on the fly.
Using an external library which does the job well is not a bad approach but it is essential to always know how to write your own solution as oppose to using a library.
Using NetworkInfo class, ConnectivityManager and TelephonyManager to determine your network type
Connection speed is usually slower on mobile data than on WiFi, but then that depends on your mobile data provider. Here, we check if connected to a WiFi network or mobile data, then further perform a check for which exact type of mobile data we are connected to.
Here we are checking for network info type and subtypes.
Below you can see a list of various subtypes. It shows the kbps for each subtype and then you can prioritize your task depending on where your subtype falls under mobile data.
Download some file from the internet & calculate how long it took vs number of bytes in the file
If you are connected on WiFi, you can assume that your connection would probably be fast, but this is not true in all cases, your WiFi network connection might go down temporarily or just reduce in speed. Network API will not indicate if your internet connection has dropped in the middle of your remote call.
To measure the quality of your network speed for proper handling, you need to download some file from the internet and calculate how long it took vs number of bytes.
Here we’ll be using using OkHttp library to fetch the required image file. OkHttp is an easy to use third-party library developed by Square for sending and receive HTTP-based network requests. If you haven’t used OkHttp, please do check it out.
So lets get started…
compile the OkHttp in build.grade
So we fetch the required image file and calculate how long it took to download the image by subtracting the end time from start time. The duration of the download definitely depends on the size of the file you are downloading, a file of 100kb should not take more than 6 secs to download under a fast internet connection.
Steps to be taken:
- We get the start time before the request is made and end time after request is completed.
- We subtract the end time from start time to get the actual download time in milliseconds, then divide by 1000 to get the seconds.
- We divide 1024 by time in seconds, to get the kilobyte per each sec download.
- You can determine if connection is poor, good or average by checking it against set of bandwidth range in KB per sec you have specified in the code.
- Also to get the download speed, we divide the file size by time taken to download.
A sample code below which shows each of those steps
Use Facebook’s Network Connection Class library
Facebook developed an open-sourced Network Connection Class library that lets apps figure quality of user’s connection on the fly.
Facebook also uses the technique of downloading a file from a URL to measure the user’s downstream bandwidth. It listens to existing internet traffic done by your app and notifies you when the user’s connection quality changes.
Steps to use the library:
compile the Facebook connection class
In your onCreate, get the instance of the connection class manager and device bandwidth sampler.
Here, we use OkHttp to make request for the image, start sampling before the request is made and stop sampling after request is completed and get the quality of the connection. If request fails, we stop sampling and retry 10x times until we get the quality.
Here we implement a listener and subscribe to it, so when the network’s connection quality changes.
This Connection library provides different connection qualities, If the quality of your connection cannot be accurately found, it returns Unknown.
Below are the list of the connection qualities:
Handling edge cases
Following the best practice can reduce issues you may face but there might still be problems relating to user going-in-and-out of networks. You should display a nice friendly message according to the current state of the network and turn off some features if possible.
Lastly, don’t be trapped in the assumption that your app is either always online or offline, it is usually in a gray area in between with consistent levels of connectivity. Apps which are built with this in mind provide responsive user experience under any network scenario.
Here is the Github repo for this post which shows those full examples above
Источник