TelephonyManager.UssdResponseCallback

public static abstract class TelephonyManager.UssdResponseCallback
extends Object

java.lang.Object
   ↳ 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(TelephonyManager, String, CharSequence) will be called if the USSD request has succeeded. onReceiveUssdResponseFailed(TelephonyManager, String, int) will be called if the USSD request has failed.

Summary

Public constructors

TelephonyManager.UssdResponseCallback()

Public methods

void onReceiveUssdResponse(TelephonyManager telephonyManager, String request, CharSequence response)

Called when a USSD request has succeeded.

void onReceiveUssdResponseFailed(TelephonyManager telephonyManager, String request, int failureCode)

Called when a USSD request has failed to complete.

Inherited methods

Public constructors

TelephonyManager.UssdResponseCallback

added in API level 26
public TelephonyManager.UssdResponseCallback ()

Public methods

onReceiveUssdResponse

added in API level 26
public void onReceiveUssdResponse (TelephonyManager telephonyManager, 
                String request, 
                CharSequence response)

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
public void onReceiveUssdResponseFailed (TelephonyManager telephonyManager, 
                String request, 
                int failureCode)

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.