Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Created July 28, 2020 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatilShreyas/1295b3f4a61fd3368646f9e07dd7594e to your computer and use it in GitHub Desktop.
Save PatilShreyas/1295b3f4a61fd3368646f9e07dd7594e to your computer and use it in GitHub Desktop.
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