Code example for TelephonyManager

Methods: getDataState

0
		public int getActualState(Context context) {
			TelephonyManager telephony = (TelephonyManager) context
					.getSystemService(Context.TELEPHONY_SERVICE);
 
			if (telephony != null) {
				return dataStateToFiveState(telephony.getDataState());
			} 
 
			return STATE_UNKNOWN;
		} 
 
		@Override 
		protected void requestStateChange(Context context, boolean desiredState) {
			ConnectivityManager connectivityManager = (ConnectivityManager) context
					.getSystemService(Context.CONNECTIVITY_SERVICE);
			if (connectivityManager != null) {
				ConnectivityHelper.setMobileDataEnabled(connectivityManager,
						desiredState);
			} 
		} 
Experience pair programming with AI  Get Codota for Java