-1

I am developing an android app where music is being streamed. Now I want to get the internet speed of the device, it may be wifi as well as mobile network speed. I want this to set the quality of the audio file according to the network speed, i.e. I want to introduce an auto streaming quality option.

So, I have read many post but not finding any solution which could target atleast minimum api level 21 i.e. android 5.0. I have found a solution in this post but the answer is only for api level 23, i.e. Android 6.

I have also found that by downloading a file we can get the internet speed but it may create a negative effect because we can't keep downloading file every time to check the internet speed. I have also found that we could ping a server and test the speed but I do not want to make useless network activity, which may eat up users mobile data.

E_net4
  • 27,810
  • 13
  • 101
  • 139
MrinmoyMk
  • 551
  • 7
  • 21

2 Answers2

1

Although this does not answer the question (sorry for that), why would you want to do that? We’re in 2020, Android 10 is out in the world and >80% of the devices support Android 6 or better: https://developer.android.com/about/dashboards

Maybe there are good reasons to stay below API level 23, but maybe your efforts are better invested elsewhere?

Sascha
  • 101
  • 5
  • Yes, you are right but I still think there are few users using Android 5.0 as per this [site](https://gs.statcounter.com/android-version-market-share/mobile-tablet/worldwide) 5.7% users still use android 5.0 – MrinmoyMk Feb 09 '20 at 16:33
0

You can use Facebook’s Network Connection Class library to figure out the quality of the current user’s internet connection on the fly.

https://github.com/facebook/network-connection-class

ROHIT LIEN
  • 497
  • 3
  • 8
  • But it is no longer maintained and its last release was on 2015. So it is better not to go with it. – MrinmoyMk Feb 10 '20 at 08:17
  • Ok , then you can keep a file on your server and try downloading it when you need to know the speed . This will give you the speed – ROHIT LIEN Feb 10 '20 at 08:47
  • I have already mentioned in the question. I don't want to keep downloading files everytime. As it is required to constantly check the network Speed – MrinmoyMk Feb 10 '20 at 09:25