public class ConnectionManager
extends java.lang.Object
Parameter |
Description |
apn |
The APN over which the connection will be made. |
username |
The user name to use to connect to the APN. May be omitted if not required by the specified APN. |
password |
The password to use to connect to the APN. May be omitted if not required by the specified APN. |
Modifier and Type | Field and Description |
---|---|
static int |
CELLULAR
This flag indicates a cellular connection.
|
static int |
CRADLE
Deprecated.
Not supported on the newer devices.
|
static int |
GPRS
Deprecated.
As of TotalCross 1.20, replaced by
CELLULAR . |
static int |
WIFI
This flag indicates a Wi-Fi connection.
|
Modifier and Type | Method and Description |
---|---|
static void |
close()
Deprecated.
Not necessary anymore.
|
static java.lang.String |
getHostAddress(java.lang.String hostName)
Returns the IP address of the given host in textual representation, or null if this information is not available.
|
static java.lang.String |
getHostName(java.lang.String hostAddress)
Returns the name of the given host, or null if this information is not available.
|
static java.lang.String |
getLocalHost()
Returns a textual representation of the IP address currently assigned to this device.
|
static java.lang.String |
getLocalHostName()
Gets the host name for this device.
|
static boolean |
isAvailable(int type)
Checks if an specific connection is currently available.
|
static boolean |
isInternetAccessible()
Returns true if we can connect to google.com using port 80, false otherwise.
|
static void |
open()
Deprecated.
Not necessary anymore.
|
static void |
open(int type)
Deprecated.
Not necessary anymore.
|
static void |
setDefaultConfiguration(int type,
java.lang.String configuration)
Deprecated.
Not used on the newer devices.
|
@Deprecated public static final int CRADLE
public static final int WIFI
public static final int CELLULAR
@Deprecated public static final int GPRS
CELLULAR
.@Deprecated public static void setDefaultConfiguration(int type, java.lang.String configuration) throws IOException
type
- one of the connection type constants defined by the ConnectionManager.configuration
- list of parameters in the format "parameter=value" separated by a semi-colon ";".IllegalArgumentIOException
- if type
is invalid.IOException
- if an I/O error occurs while configuring the connection.CRADLE
,
WIFI
,
CELLULAR
public static boolean isAvailable(int type) throws IOException
type
- one of the connection type constants defined by the ConnectionManager.IllegalArgumentIOException
- if type
is invalid.IOException
- if an I/O error occurs while checking connection availability.CRADLE
,
WIFI
,
CELLULAR
@Deprecated public static void open() throws IOException
CRADLE
, WIFI
and CELLULAR
.IOException
- if an I/O error occurs while opening the connection.@Deprecated public static void open(int type) throws IOException
type
- one of the connection type constants defined by the ConnectionManager.IllegalArgumentIOException
- if type
is invalid.IOException
- if an I/O error occurs while opening the connection.CRADLE
,
WIFI
,
CELLULAR
@Deprecated public static void close() throws IOException
IOException
- if an I/O error occurs while closing a connection.public static java.lang.String getHostAddress(java.lang.String hostName) throws UnknownHostException
hostName
- the host's name.UnknownHostException
- if the given host is unknown or cannot be reached.public static java.lang.String getHostName(java.lang.String hostAddress) throws UnknownHostException
hostAddress
- textual representation of the host's IP address.UnknownHostException
- if the given host is unknown or cannot be reached.public static java.lang.String getLocalHost() throws UnknownHostException
UnknownHostException
- if the local host is unknown or cannot be reached.public static java.lang.String getLocalHostName() throws UnknownHostException
UnknownHostException
public static boolean isInternetAccessible()