Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#pubctors) \| [Methods](https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#inhmethods)

# TelephonyManager.UssdResponseCallback

*** ** * ** ***


`
public
static

abstract
class
TelephonyManager.UssdResponseCallback
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.telephony.TelephonyManager.UssdResponseCallback |

<br />

*** ** * ** ***

Used to notify callers of
`https://developer.android.com/reference/android/telephony/TelephonyManager#sendUssdRequest(java.lang.String,%20android.telephony.TelephonyManager.UssdResponseCallback,%20android.os.Handler)` when the
network either successfully executes a USSD request, or if there was a failure while
executing the request.


`https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#onReceiveUssdResponse(android.telephony.TelephonyManager,%20java.lang.String,%20java.lang.CharSequence)` will be called if the
USSD request has succeeded.
`https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#onReceiveUssdResponseFailed(android.telephony.TelephonyManager,%20java.lang.String,%20int)` will be called if the
USSD request has failed.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#UssdResponseCallback()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#onReceiveUssdResponse(android.telephony.TelephonyManager,%20java.lang.String,%20java.lang.CharSequence)(https://developer.android.com/reference/android/telephony/TelephonyManager telephonyManager, https://developer.android.com/reference/java/lang/String request, https://developer.android.com/reference/java/lang/CharSequence response) ` Called when a USSD request has succeeded. |
| ` void` | ` https://developer.android.com/reference/android/telephony/TelephonyManager.UssdResponseCallback#onReceiveUssdResponseFailed(android.telephony.TelephonyManager,%20java.lang.String,%20int)(https://developer.android.com/reference/android/telephony/TelephonyManager telephonyManager, https://developer.android.com/reference/java/lang/String request, int failureCode) ` Called when a USSD request has failed to complete. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

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


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

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


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

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


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

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


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(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` `
https://developer.android.com/reference/java/lang/Object#wait(long)(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` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

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


## Public constructors

### UssdResponseCallback

```
public UssdResponseCallback ()
```

<br />

<br />

## Public methods

### onReceiveUssdResponse

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

<br />

| Parameters ||
|---|---|
| `telephonyManager` | `TelephonyManager`: the TelephonyManager the callback is registered to. <br /> |
| `request` | `String`: the USSD request sent to the mobile network. <br /> |
| `response` | `CharSequence`: the response to the USSD request provided by the mobile network. <br /> |

### onReceiveUssdResponseFailed

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Called when a USSD request has failed to complete.

<br />

| Parameters ||
|---|---|
| `telephonyManager` | `TelephonyManager`: the TelephonyManager the callback is registered to. <br /> |
| `request` | `String`: the USSD request sent to the mobile network. <br /> |
| `failureCode` | `int`: failure code indicating why the request failed. Will be one of `https://developer.android.com/reference/android/telephony/TelephonyManager#USSD_RETURN_FAILURE`, `https://developer.android.com/reference/android/telephony/TelephonyManager#USSD_ERROR_SERVICE_UNAVAIL`, or `https://developer.android.com/reference/android/telephony/TelephonyManager#USSD_ERROR_NOT_ALLOWED`. <br /> |