/**@class android.net.SocketKeepalive implements java.lang.AutoCloseable @extends java.lang.Object Allows applications to request that the system periodically send specific packets on their behalf, using hardware offload to save battery power. To request that the system send keepalives, call one of the methods that return a {@link android.net.SocketKeepalive} object, such as {@link android.net.ConnectivityManager#createSocketKeepalive}, passing in a non-null callback. If the {@link android.net.SocketKeepalive} is successfully started, the callback's {@code onStarted} method will be called. If an error occurs, {@code onError} will be called, specifying one of the {@code ERROR_*} constants in this class. To stop an existing keepalive, call {@link android.net.SocketKeepalive#stop}. The system will call {@link android.net.SocketKeepalive.Callback#onStopped} if the operation was successful or {@link android.net.SocketKeepalive.Callback#onError} if an error occurred. For cellular, the device MUST support at least 1 keepalive slot. For WiFi, the device SHOULD support keepalive offload. If it does not, it MUST reply with {@link android.net.SocketKeepalive.Callback#onError} with {@code ERROR_UNSUPPORTED} to any keepalive offload request. If it does, it MUST support at least 3 concurrent keepalive slots. */ var SocketKeepalive = { /**@hide */ SUCCESS : "0", /**@hide */ NO_KEEPALIVE : "-1", /**@hide */ DATA_RECEIVED : "-2", /**@hide */ BINDER_DIED : "-10", /**The specified {@code Network} is not connected. */ ERROR_INVALID_NETWORK : "-20", /**The specified IP addresses are invalid. For example, the specified source IP address is not configured on the specified {@code Network}. */ ERROR_INVALID_IP_ADDRESS : "-21", /**The requested port is invalid. */ ERROR_INVALID_PORT : "-22", /**The packet length is invalid (e.g., too long). */ ERROR_INVALID_LENGTH : "-23", /**The packet transmission interval is invalid (e.g., too short). */ ERROR_INVALID_INTERVAL : "-24", /**The target socket is invalid. */ ERROR_INVALID_SOCKET : "-25", /**The target socket is not idle. */ ERROR_SOCKET_NOT_IDLE : "-26", /**The device does not support this request. */ ERROR_UNSUPPORTED : "-30", /**@hide TODO: delete when telephony code has been updated. */ ERROR_HARDWARE_UNSUPPORTED : "-30", /**The hardware returned an error. */ ERROR_HARDWARE_ERROR : "-31", /**The limitation of resource is reached. */ ERROR_INSUFFICIENT_RESOURCES : "-32", /** The minimum interval in seconds between keepalive packet transmissions. @hide */ MIN_INTERVAL_SEC : "10", /** The maximum interval in seconds between keepalive packet transmissions. @hide */ MAX_INTERVAL_SEC : "3600", /**Request that keepalive be started with the given {@code intervalSec}. See {@link android.net.SocketKeepalive}. If the remote binder dies, or the binder call throws an exception when invoking start or stop of the {@link android.net.SocketKeepalive}, a {@link RemoteException} will be thrown into the {@code executor}. This is typically not important to catch because the remote party is the system, so if it is not in shape to communicate through binder the system is probably going down anyway. If the caller cares regardless, it can use a custom {@link Executor} to catch the {@link RemoteException}. @param {Number} intervalSec The target interval in seconds between keepalive packet transmissions. The interval should be between 10 seconds and 3600 seconds, otherwise {@link #ERROR_INVALID_INTERVAL} will be returned. */ start : function( ) {}, /**Requests that keepalive be stopped. The application must wait for {@link android.net.DnsResolver.Callback#onStopped} before using the object. See {@link android.net.SocketKeepalive}. */ stop : function( ) {}, /**Deactivate this {@link android.net.SocketKeepalive} and free allocated resources. The instance won't be usable again if {@code close()} is called. */ close : function( ) {}, };