public class CellularNetwork
extends java.lang.Object
Typically, to be aware of current information about CellularNetworks,
an application will not retain references to CellularNetworks instances
but will use the CellularNetworkListener
or #getCellularNetworks
mechanisms.
getProperties()
:
Property | Description | Value | Network Type |
---|---|---|---|
mcc | MCC (Mobile Country Code) number of the network | MCC number | 3GPP, CDMA |
mnc | MNC (Mobile Network Code) number of the network | MNC number | 3GPP |
sid | SID (System Identifier) number of the network | SID number | CDMA |
nid | NID (Network Identifier) number of the network | NID number | CDMA |
Cell properties available via getCellProperties()
:
Property | Description | Value | Network Type |
---|---|---|---|
lac | LAC (Local Area Code) number of the current cell | LAC number | 3GPP |
cid | CID (Cell Identifier) number of the current cell | CID number | 3GPP |
bid | BID (Base Station Identifier) number of the current cell | BID number | CDMA |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DATA_NETWORK
To be used as an event name for
Event . |
static java.lang.String |
DATA_NETWORK_3GPP_CSD
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_3GPP_PD
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_3GPP_PD_3G
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_3GPP_PD_EDGE
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_3GPP_PD_HSDPA
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_802DOT11
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_802DOT16
Valid value for
DATA_NETWORK events. |
static java.lang.String |
DATA_NETWORK_CDMA
Valid value for
DATA_NETWORK events. |
static int |
NETWORK_3GPP
Network type 3GPP.
|
static int |
NETWORK_CDMA
Network type CDMA.
|
Modifier and Type | Method and Description |
---|---|
static void |
addListener(CellularNetworkListener listener)
Adds listener to receive cellular networks related events.
|
java.util.Map<java.lang.String,java.lang.String> |
getCellProperties()
Returns a map containing current cell identifiers.
|
static CellularNetwork[] |
getCellularNetworks()
Returns all cellular networks to which the device is connected.
|
java.lang.String |
getDataProtocol()
Returns the data protocol currently used in this network.
|
int |
getNetworkType()
Retrieves the network type.
|
java.lang.String |
getOperator()
Returns the network operator name.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns a map containing network properties, such as
operator and network identifiers.
|
int |
getSignalStrength()
Returns the current signal strength.
|
Subscriber |
getSubscriber()
Returns the Subscriber for the network.
|
boolean |
isRoaming()
Indicates whether the subscriber registered to this network is
considered to be roaming.
|
static void |
removeListener(CellularNetworkListener listener)
Removes previously added listener.
|
public static final java.lang.String DATA_NETWORK
Event
.
Indicates the available data networks. This event is sent to the requested
applications whenever there is a change in the list of available data networks.
This notification MUST be sent if a new data network appears or a data
network is lost. The event contains the list of all currently available
data networks. The data networks are indicates as a semicolon separated
list of the technology names in the Event
value field.
The data network technology names MUST be the following:
public static final java.lang.String DATA_NETWORK_3GPP_CSD
DATA_NETWORK
events.
Data network technology name for circuit switched data (CSD).
This is part of the 3GPP defined set of radio interface technologies.public static final java.lang.String DATA_NETWORK_3GPP_PD
DATA_NETWORK
events.
Data network technology name for packet data in the GSM network.
This is part of the 3GPP defined set of radio interface technologies.public static final java.lang.String DATA_NETWORK_3GPP_PD_3G
DATA_NETWORK
events.
Data network technology name for packet data in the 3G(UMTS)
network. This is part of the 3GPP defined set of radio interface
technologies.public static final java.lang.String DATA_NETWORK_3GPP_PD_EDGE
DATA_NETWORK
events.
Data network technology name for packet data in the EDGE network.
This is part of the 3GPP defined set of radio interface technologies.public static final java.lang.String DATA_NETWORK_3GPP_PD_HSDPA
DATA_NETWORK
events.
Data network technology name for high speed download packet
data in the 3G network (HSDPA). This is part of the 3GPP defined
set of radio interface technologies.public static final java.lang.String DATA_NETWORK_802DOT11
DATA_NETWORK
events.
Data network technology name for the 802.11 WiFi family of interfaces.
This value includes access technology variants of 802.11a, 802.11b,
802.11g and 802.11n, along with support for any of the optional QoS
and hand-over extensions.public static final java.lang.String DATA_NETWORK_802DOT16
DATA_NETWORK
events.
Data network technology name for the 802.16 WiMax interface standards.
This is primarily for the 802.16e mobile WiMax specification, but can also
be used for the fixed 802.16 specification.public static final java.lang.String DATA_NETWORK_CDMA
DATA_NETWORK
events.
Data network technology name for the CDMA/3GPP2 defined set of radio
interface technologies. This includes CDMA, CDMA-2000, CDMA 1X,
CDMA-EvDO and EVDO rev A(DOrA).public static final int NETWORK_3GPP
public static final int NETWORK_CDMA
public static CellularNetwork[] getCellularNetworks()
public static void addListener(CellularNetworkListener listener)
As soon as a listener is added it will be notified about all currently connected networks, i.e. notifyNetworkEvent with NETWORK_CONNECTED event will be called for each connected network. This prevents race condition that could exist between registering listener and connecting to the network.
Does nothing if the listener is already registered as a cellular network listener.
listener
- the listener to addjava.lang.NullPointerException
- if the listener is nullpublic static void removeListener(CellularNetworkListener listener)
Does nothing if the listener is not registered as a cellular network listener.
listener
- the listener to removejava.lang.NullPointerException
- if the listener is nullpublic int getNetworkType()
NETWORK_3GPP
or
NETWORK_CDMA
public Subscriber getSubscriber()
public java.lang.String getOperator() throws java.lang.SecurityException
The operator name is retrieved while registering the device with the network and does not change.
java.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "network".public boolean isRoaming() throws NetworkDisconnectedException
NetworkDisconnectedException
- if device was disconnected from this
networkpublic java.lang.String getDataProtocol() throws NetworkDisconnectedException
NetworkDisconnectedException
- if device was disconnected from this
networkpublic int getSignalStrength() throws NetworkDisconnectedException
NetworkDisconnectedException
- if device was disconnected from this
networkpublic java.util.Map<java.lang.String,java.lang.String> getProperties()
The keys are defined in the Cellular Network Properties Table.
The values are only available if the getNetworkType()
value
is listed for the key.
The value null
is returned from Map.get(key)
if the key is not defined for the network type.
java.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "network".public java.util.Map<java.lang.String,java.lang.String> getCellProperties() throws NetworkDisconnectedException
The keys are defined in the Cell Properties Table.
The values are only available if the getNetworkType()
is listed for the key.
The value null
is returned from Map.get(key)
if the key is not defined for the network type.
java.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "network".NetworkDisconnectedException
- if device was disconnected from this
networkCopyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.