com.nokia.mid.network
Class NetworkState

java.lang.Object
  extended by com.nokia.mid.network.NetworkState

public final class NetworkState
extends java.lang.Object

NetworkState provides network setting, state retrieving and change notification to client which implements NetworkStateListener interface

Copyright (c) 2012 Nokia Mobile Phones

Code Snippet 1:
// This is a sample code to get the nework state of the sim card in second slot

    NetworkState.getState(1);

 

Code Snippet 2:

// This is a sample code to subscribe network state change event

    try{
            NetworkState.subscribeListener(this);
        } catch (Exception e) {
        }

 

Code Snippet 3:

// This is a sample code to implement a NetworkStateListener in a class which implements this interface

public void networkStateChanged(int simIndex, int state) {
    form.append("recevie network state on sim slot " + simIndex + " state is " + state);
}
 


Field Summary
static int NETWORK_STATE_HOME
          Constant for network state (Home, in home network).
static int NETWORK_STATE_NO_NETWORK
          Constant for network state (No Network, no network).
static int NETWORK_STATE_ROAMING
          Constant for network state (Roaming, in roaming network).
 
Method Summary
static int getState(int simIndex)
          get network state for one sim card.
static void subscribeListener(NetworkStateListener listener)
          Subscribe network state listener.
static void unSubscribeListener(NetworkStateListener listener)
          unSubscribe network state listener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORK_STATE_HOME

public static final int NETWORK_STATE_HOME

Constant for network state (Home, in home network).

NETWORK_STATE_HOME has the value 0x01.

See Also:
Constant Field Values

NETWORK_STATE_ROAMING

public static final int NETWORK_STATE_ROAMING

Constant for network state (Roaming, in roaming network).

NETWORK_STATE_ROAMING has the value 0x02.

See Also:
Constant Field Values

NETWORK_STATE_NO_NETWORK

public static final int NETWORK_STATE_NO_NETWORK

Constant for network state (No Network, no network).

NETWORK_STATE_NONETWORK has the value 0x03.

See Also:
Constant Field Values
Method Detail

subscribeListener

public static void subscribeListener(NetworkStateListener listener)
Subscribe network state listener.

Parameters:
listener - the object that will receive the network state event.

unSubscribeListener

public static void unSubscribeListener(NetworkStateListener listener)
unSubscribe network state listener.

Parameters:
listener - the object that is receiving the network state event.

getState

public static int getState(int simIndex)
                    throws java.lang.IllegalArgumentException
get network state for one sim card.

Parameters:
simIndex - the index of sim card which state is queried. 0 for sim card in first slot and 1 for sim card in second slot
Throws:
java.lang.IllegalArgumentException - If simIndex is not valid.