Stay organized with collections
Save and categorize content based on your preferences.
SocketKeepalive.Callback
public
static
class
SocketKeepalive.Callback
extends Object
The callback which app can use to learn the status changes of SocketKeepalive
. See
SocketKeepalive
.
Summary
Public methods |
void
|
onDataReceived()
The keepalive on a TCP socket was stopped because the socket received data.
|
void
|
onError(int error)
An error occurred.
|
void
|
onStarted()
The requested keepalive was successfully started.
|
void
|
onStopped()
The keepalive was successfully stopped.
|
Inherited methods |
From class
java.lang.Object
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
Callback
public Callback ()
Public methods
onDataReceived
public void onDataReceived ()
The keepalive on a TCP socket was stopped because the socket received data. This is
never called for UDP sockets.
onError
public void onError (int error)
An error occurred.
onStarted
public void onStarted ()
The requested keepalive was successfully started.
onStopped
public void onStopped ()
The keepalive was successfully stopped.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# SocketKeepalive.Callback\n\nAdded in [API level 29](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nSocketKeepalive.Callback\n========================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/net/SocketKeepalive.Callback \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\nclass\nSocketKeepalive.Callback\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|--------------------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.net.SocketKeepalive.Callback |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe callback which app can use to learn the status changes of [SocketKeepalive](/reference/android/net/SocketKeepalive). See\n[SocketKeepalive](/reference/android/net/SocketKeepalive).\n\nSummary\n-------\n\n| ### Public constructors ||\n|--------------------------------------------------------------------------------|---|\n| ` `[Callback](/reference/android/net/SocketKeepalive.Callback#Callback())`() ` |\n\n| ### Public methods ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[onDataReceived](/reference/android/net/SocketKeepalive.Callback#onDataReceived())`() ` The keepalive on a TCP socket was stopped because the socket received data. |\n| ` void` | ` `[onError](/reference/android/net/SocketKeepalive.Callback#onError(int))`(int error) ` An error occurred. |\n| ` void` | ` `[onStarted](/reference/android/net/SocketKeepalive.Callback#onStarted())`() ` The requested keepalive was successfully started. |\n| ` void` | ` `[onStopped](/reference/android/net/SocketKeepalive.Callback#onStopped())`() ` The keepalive was successfully stopped. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/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 `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/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` | ` `[wait](/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` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic constructors\n-------------------\n\n### Callback\n\nAdded in [API level 29](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic Callback ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### onDataReceived\n\nAdded in [API level 29](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void onDataReceived ()\n```\n\nThe keepalive on a TCP socket was stopped because the socket received data. This is\nnever called for UDP sockets.\n\n\u003cbr /\u003e\n\n### onError\n\nAdded in [API level 29](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void onError (int error)\n```\n\nAn error occurred.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `error` | `int`: Value is [SocketKeepalive.ERROR_INVALID_NETWORK](/reference/android/net/SocketKeepalive#ERROR_INVALID_NETWORK), [SocketKeepalive.ERROR_INVALID_IP_ADDRESS](/reference/android/net/SocketKeepalive#ERROR_INVALID_IP_ADDRESS), [SocketKeepalive.ERROR_INVALID_PORT](/reference/android/net/SocketKeepalive#ERROR_INVALID_PORT), [SocketKeepalive.ERROR_INVALID_LENGTH](/reference/android/net/SocketKeepalive#ERROR_INVALID_LENGTH), [SocketKeepalive.ERROR_INVALID_INTERVAL](/reference/android/net/SocketKeepalive#ERROR_INVALID_INTERVAL), [SocketKeepalive.ERROR_INVALID_SOCKET](/reference/android/net/SocketKeepalive#ERROR_INVALID_SOCKET), [SocketKeepalive.ERROR_SOCKET_NOT_IDLE](/reference/android/net/SocketKeepalive#ERROR_SOCKET_NOT_IDLE), or android.net.SocketKeepalive.ERROR_NO_SUCH_SLOT \u003cbr /\u003e |\n\n### onStarted\n\nAdded in [API level 29](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void onStarted ()\n```\n\nThe requested keepalive was successfully started.\n\n\u003cbr /\u003e\n\n### onStopped\n\nAdded in [API level 29](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void onStopped ()\n```\n\nThe keepalive was successfully stopped.\n\n\u003cbr /\u003e"]]