Added in API level 26

UssdResponseCallback

abstract class UssdResponseCallback
kotlin.Any
   ↳ android.telephony.TelephonyManager.UssdResponseCallback

Used to notify callers of TelephonyManager#sendUssdRequest(String, UssdResponseCallback, Handler) when the network either successfully executes a USSD request, or if there was a failure while executing the request.

onReceiveUssdResponse(android.telephony.TelephonyManager,java.lang.String,java.lang.CharSequence) will be called if the USSD request has succeeded. onReceiveUssdResponseFailed(android.telephony.TelephonyManager,java.lang.String,int) will be called if the USSD request has failed.

Summary

Public constructors

Public methods
open Unit
onReceiveUssdResponse(telephonyManager: TelephonyManager!, request: String!, response: CharSequence!)

Called when a USSD request has succeeded.

open Unit
onReceiveUssdResponseFailed(telephonyManager: TelephonyManager!, request: String!, failureCode: Int)

Called when a USSD request has failed to complete.

Public constructors

UssdResponseCallback

UssdResponseCallback()

Public methods

onReceiveUssdResponse

Added in API level 26
open fun onReceiveUssdResponse(
    telephonyManager: TelephonyManager!,
    request: String!,
    response: CharSequence!
): Unit

Called when a USSD request has succeeded. The response contains the USSD response received from the network. The calling app can choose to either display the response to the user or perform some operation based on the response.

USSD responses are unstructured text and their content is determined by the mobile network operator.

Parameters
telephonyManager TelephonyManager!: the TelephonyManager the callback is registered to.
request String!: the USSD request sent to the mobile network.
response CharSequence!: the response to the USSD request provided by the mobile network.

onReceiveUssdResponseFailed

Added in API level 26
open fun onReceiveUssdResponseFailed(
    telephonyManager: TelephonyManager!,
    request: String!,
    failureCode: Int
): Unit

Called when a USSD request has failed to complete.

Parameters
telephonyManager TelephonyManager!: the TelephonyManager the callback is registered to.
request String!: the USSD request sent to the mobile network.
failureCode Int: failure code indicating why the request failed. Will be either TelephonyManager#USSD_RETURN_FAILURE or TelephonyManager#USSD_ERROR_SERVICE_UNAVAIL.