-
public interface ITelephonyManagerCompat
-
-
Method Summary
Modifier and Type Method Description abstract TelephonyManagergetTelephonyManager()Getter for AOSP's telephony manager that is used to obtain all info abstract IntegergetSubscriberId()Current subscriber id, Int.MAX_VALUE if invalid or unspecified abstract UnitgetAllCellInfo(Function1<List<ICell>, Unit> onSuccess)Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells. abstract UnitgetAllCellInfo(Function1<List<ICell>, Unit> onSuccess, Function1<CellError, Unit> onError)Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells. abstract List<ICell>getAllCellInfo(Long timeoutMilliseconds)Works as other getAllCellInfo methods but intentionally BLOCKS current thread till data are not retrieved from system and post-processed. abstract List<ICell>getCellLocation()Attempts to retrieve cell information using older telephony methods. abstract List<ICell>getNeighboringCellInfo()Returns the neighboring cell information for GSM (CID, LAC, RSSI) and WCDMA networks (PSC, RSSI). abstract NetworkTypegetNetworkType()Currently active network technology grabbed from AOSP and mapped to NetworkType. abstract ServiceStategetServiceState()Obtains synchronously current ServiceState. abstract NetworkgetNetworkOperator()PLMN of currently registered network. abstract NetworkgetSimOperator()PLMN of SIM card that is assigned to current subscription Expect nullin CDMA networks and when phone is not connected to networks.abstract SignalStrengthgetSignalStrength()Fetches the most recent information about signal from the modem. abstract DisplayInfogetDisplayInfo()Fetches information about current network type and possible override that should be presented to user. -
-
Method Detail
-
getTelephonyManager
abstract TelephonyManager getTelephonyManager()
Getter for AOSP's telephony manager that is used to obtain all info
-
getSubscriberId
abstract Integer getSubscriberId()
Current subscriber id, Int.MAX_VALUE if invalid or unspecified
-
getAllCellInfo
@WorkerThread()@RequiresPermission(allOf = {android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION}) abstract Unit getAllCellInfo(Function1<List<ICell>, Unit> onSuccess)
Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells.
Make sure to call this method on worker thread since it might take a while to fetch and process the data (reflection is involved here).
This method always invokes request to RIL so returned data are as fresh as possible. If any error occurs during processing then onSuccess is invoked with latest valid data. If none are present then expect empty list.
Based on:
-
getAllCellInfo
@WorkerThread()@RequiresPermission(allOf = {android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION}) abstract Unit getAllCellInfo(Function1<List<ICell>, Unit> onSuccess, Function1<CellError, Unit> onError)
Requests all available cell information from all radios on the device including the camped/registered, serving, and neighboring cells.
Make sure to call this method on worker thread since it might take a while to fetch and process the data (reflection is involved here).
This method always invokes request to RIL so returned data are as fresh as possible. If onError is not passed then this method will call onSuccess with an empty list.
Based on:
-
getAllCellInfo
@WorkerThread()@RequiresPermission(allOf = {android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION}) abstract List<ICell> getAllCellInfo(Long timeoutMilliseconds)
Works as other getAllCellInfo methods but intentionally BLOCKS current thread till data are not retrieved from system and post-processed.
This method always does not block current thread for longer than timeoutMilliseconds. In case of timeout empty list is returned, no exceptions are thrown here.
-
getCellLocation
@WorkerThread()@RequiresPermission(allOf = {android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION, android.permission.READ_PHONE_STATE}) abstract List<ICell> getCellLocation()
Attempts to retrieve cell information using older telephony methods. Result is eventually merged into our ICell representation.
Since underlying methods are deprecated AOSP advises you to migrate to getAllCellInfo if possible. However not all terminals do not work properly with new way of retrieving cells.
Supports only ICell subset:
Based on:
-
getNeighboringCellInfo
@WorkerThread()@RequiresPermission(value = android.permission.ACCESS_COARSE_LOCATION) abstract List<ICell> getNeighboringCellInfo()
Returns the neighboring cell information for GSM (CID, LAC, RSSI) and WCDMA networks (PSC, RSSI). Other networks are not supported. To get more information use getAllCellInfo.
Supports only ICell subset:
Based on:
TelephonyManager.getNeighboringCellInfo
-
getNetworkType
@RequiresPermission(value = android.permission.ACCESS_COARSE_LOCATION) abstract NetworkType getNetworkType()
Currently active network technology grabbed from AOSP and mapped to NetworkType.
Based on:
-
getServiceState
@WorkerThread()@RequiresPermission(allOf = {android.permission.READ_PHONE_STATE, android.permission.ACCESS_COARSE_LOCATION}) abstract ServiceState getServiceState()
Obtains synchronously current ServiceState.
This information was available since SDK 1, however till SDK 26 registering of PhoneStateListener was required to obtain the data. This method just simplifies access to the data.
Based on:
-
getNetworkOperator
@WorkerThread()@RequiresPermission(allOf = {android.permission.READ_PHONE_STATE, android.permission.ACCESS_COARSE_LOCATION}) abstract Network getNetworkOperator()
PLMN of currently registered network. Expect
nullin CDMA networks and when phone is not connected to networks. Some devices return valid values even when they are in 'Emergency calls only' mode.Based on:
TelephonyManager.getNetworkOperator (fallback if previous one returns
null)
-
getSimOperator
@WorkerThread() abstract Network getSimOperator()
PLMN of SIM card that is assigned to current subscription Expect
nullin CDMA networks and when phone is not connected to networks.Based on:
-
getSignalStrength
@WorkerThread() abstract SignalStrength getSignalStrength()
Fetches the most recent information about signal from the modem. In case of failure returns cached data.
Based on:
-
getDisplayInfo
@WorkerThread()@RequiresPermission(allOf = {android.permission.ACCESS_COARSE_LOCATION, android.permission.READ_PHONE_STATE}) abstract DisplayInfo getDisplayInfo()
Fetches information about current network type and possible override that should be presented to user.
On SDKs lower than Build.VERSION_CODES.R always returns DisplayInfo with unknown network type and none override type
-
-
-
-