Code example for ServiceState

Methods: getState, setState

0
	} 
    } 
 
    @Override 
    public void onServiceStateChanged(ServiceState serviceState) {
	switch (serviceState.getState()) {
	case ServiceState.STATE_IN_SERVICE:
	    Log.i(TAG, "MyPhoneStateListener->onServiceStateChanged() -> STATE_IN_SERVICE");
	    serviceState.setState(ServiceState.STATE_IN_SERVICE);
	    break; 
	case ServiceState.STATE_OUT_OF_SERVICE:
	    Log.i(TAG, "MyPhoneStateListener->onServiceStateChanged() -> STATE_OUT_OF_SERVICE");
	    serviceState.setState(ServiceState.STATE_OUT_OF_SERVICE);
	    break; 
	case ServiceState.STATE_EMERGENCY_ONLY:
	    Log.i(TAG, "MyPhoneStateListener->onServiceStateChanged() -> STATE_EMERGENCY_ONLY");
	    serviceState.setState(ServiceState.STATE_EMERGENCY_ONLY);
	    break; 
	case ServiceState.STATE_POWER_OFF:
	    Log.i(TAG, "MyPhoneStateListener->onServiceStateChanged() -> STATE_POWER_OFF");
	    serviceState.setState(ServiceState.STATE_POWER_OFF);
	    break; 
	default: 
	    Log.i(TAG, "MyPhoneStateListener->onServiceStateChanged() -> default -> " + Integer.toString(serviceState.getState()));
	    break; 
	} 
    } 
}