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(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

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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

UssdResponseCallback

public 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.