Sara-Omidvar
Sara-Omidvar

Reputation: 73

How find the LTE bandwidth in Android

I need to find the LTE bandwidth in Android. I tried requestCellInfoUpdate method in TelephonyManager:

cellInfoCallbackObject = MyCellInfoCallback()
executor = requireActivity().mainExecutor
tm.requestCellInfoUpdate(executor, cellInfoCallbackObject)


class MyCellInfoCallback( ) : TelephonyManager.CellInfoCallback() {
     override fun onCellInfo(cellInfoList: MutableList<CellInfo>) {
             for (cellInfo in cellInfoList) {
                 if ((cellInfo is CellInfoLte) && cellInfo.isRegistered) {
                    val bandwidth =cellInfo.cellIdentity.bandwidth.toString()
              }
}}}

But it returns an invalid value. Can anyone help me?

Edit: The invalid value is 2147483647. I tested on "Samsung SMA-336E" and " Xiaomi M2003j15SC" with Android 12. In Iran country and IR-MCI operator. Some other applications such as G-NetTrack Lite, show the bandwidth on these phones correctly.

Upvotes: 0

Views: 237

Answers (0)

Related Questions