List of usage examples for android.net ConnectivityManager getNetworkPreference
@Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public int getNetworkPreference()
From source file:org.restcomm.app.qoslib.Services.LibPhoneStateListener.java
@SuppressLint("InlinedApi") @SuppressWarnings("deprecation") public int networkPreference(Context context) { String pref = null;/*from w w w. j a v a 2s. co m*/ ConnectivityManager con = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); int attemptTwo = con.getNetworkPreference(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { return Settings.System.getInt(context.getContentResolver(), Settings.System.NETWORK_PREFERENCE, 0); } else { return Settings.Global.getInt(context.getContentResolver(), Settings.Global.NETWORK_PREFERENCE, 0); } }