I'm willing to detect if roaming switch on a telephone is turned off.
if (Build.VERSION.SDK_INT < 17) {
isDataRoamingDisabled =
(Settings.System.getInt(context.getContentResolver(), Settings.Secure.DATA_ROAMING, 0)
== 0);
} else {
isDataRoamingDisabled =
(Settings.Global.getInt(context.getContentResolver(), Settings.Global.DATA_ROAMING, 0)
== 0);
}
Unfortunately only for OnePlus One/Two/Three the setting is always false (0). On rest devices that i tested - Nexus 6P, LG G5, Samsung S5 all is working fine...
telephonyManager.isNetworkRoaming(),
is not really the solution here since it detects if a user in roaming and not switch in settings.
Thanks for help! :)
I found some solution regarding this issue.. It seems like it caused by the using of Dual SIM on these devices, which adopted the newer API for this functionality. (I found it on the source code of Oxygen)
READ_PHONE_STATE
permission