0

im new to android app development and currently trying to get the eNB in Android Studio with Kotlin. Im aware of this solution: How to get eNB id of LTE on Android Studio (TelephonyManager)

However, if I try to implement this, my app just crashes and I get no feedback. Is there anything special you need to keep in mind when setting up your app to get mobile cell data?

Thank you!

F4Wins
  • 11
  • 1

1 Answers1

0

Just initialize a TelephonyManager from the Telephony_Service and by filtering for the different mobile net standards like UMTS (3G), LTE (4G) or NR (5G) and using the "getallCellInfo Method, you can get all relevant information from the current cell your phone is connected with. Here is the code:

val tm = getSystemService(TELEPHONY_SERVICE) as TelephonyManager
val cellInfo = tm.allCellInfo
if(cellInfo != null){
    for(info in cellInfo){
        if(info is CellInfoLte){
            val identityLte = info.cellIdentity
            val operator = identityLte.operatorAlphaLong.toString()
            // get more Information like mcc, mnc, pci, tac, ... //
        }
    }
}
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
F4Wins
  • 11
  • 1