Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Created July 28, 2020 14:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
fun getCellInfo(info: CellInfoGsm): CellInfo {
val cellInfo = CellInfo()
cellInfo.radio = RadioType.GSM
info.cellIdentity.let {
val (mcc, mnc) = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Pair(it.mccString?.toInt() ?: 0, it.mncString?.toInt() ?: 0)
} else {
Pair(it.mcc, it.mnc)
}
cellInfo.mcc = mcc
cellInfo.mnc = mnc
cellInfo.cells = listOf(Cell(it.lac, it.cid, it.psc))
}
return cellInfo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment