Is there a way to detect all the network capabilities of a android device?

221 views Asked by At

By Network Capabilities I mean - is NR,LTE,CDMA,UMTS,GSM supported? is wifi / mobile data supported? I just want to know if the device is capable of doing the above. I do not need to know the current active network stuff.

https://developer.android.com/reference/android/net/NetworkCapabilities - this api is little helpful but does not completely fulfill my need.

Also I wanted to know if my device has the features like wifi / bluetooth / cellular capabilities?

2

There are 2 answers

0
Akshay Chougule On

I found a solution to detect hardware capabilities using packetmanager. Ex:

getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI);

This will help user know if the device is capable of certain feature or not.

0
Mouaad Abdelghafour AITALI On

I've always used this powerful library in all of my projects :

implementation 'com.blankj:utilcodex:1.29.0'

Usage :

        LogUtils.i("NetworkUtils isConnect = %b" , NetworkUtils.isConnected());
        LogUtils.i("NetworkUtils isAvailableByPing = %b" , NetworkUtils.isAvailableByPing());
        LogUtils.i("NetworkUtils isWifiEnable = %b" , NetworkUtils.getWifiEnabled());
        LogUtils.i("NetworkUtils isWifiConnected = %b" , NetworkUtils.isWifiConnected());
        LogUtils.i("NetworkUtils is4G = %b" , NetworkUtils.is4G());
        LogUtils.i("NetworkUtils getNetworkType = %s", NetworkUtils.getNetworkType());

For more accessibility check the PhoneUtils & NetworkUtils classes :

https://github.com/Blankj/AndroidUtilCode