Code example for ServiceState

Methods: getRoaminggetState

0
		 
		@Override 
    	public void onServiceStateChanged(ServiceState serviceState) {
    		 
    		//converting state information from int to corresponding string 
        	switch(serviceState.getState()) {
	        	case ServiceState.STATE_IN_SERVICE:
	        		show_state_string = "In Service";
	        		break; 
	        		 
	        	case ServiceState.STATE_OUT_OF_SERVICE:
	        		show_state_string = "Out of Service";
	        		break; 
	        		 
	        	case ServiceState.STATE_EMERGENCY_ONLY:
	        		show_state_string = "Emergency Only";
	        		break; 
	        		 
	        	case ServiceState.STATE_POWER_OFF:
	        		show_state_string = "Power Off";
	        		break; 
	        		 
	        	default: 
	        		show_state_string = "State Unknown";
	        		break; 
	        } 
    		 
    		super.onServiceStateChanged(serviceState);
    		 
    		//---------------------------------------------- ROAMING STATUS ----------------------------------------------------------// 
             
            //roaming status in boolean 
            boolean roaming = serviceState.getRoaming();
             
            if(roaming == true)
            { 
            	roaming_str = "Roaming";
            } 
Experience pair programming with AI  Get Codota for Java