Do we have any flag or value on the phone which can help decide this ?

有帮助吗?

解决方案

I think it's not possible, you can just differenciate whether you're using roaming or not, but at least officially I can't find any info about this.

---- EDIT ----

As probably there's not a built-int method for this, you could simply define and keep an internal list of national telephony companies and see whether the SIM's operator match one of them, in which case you'll be having a national roaming, an international roaming if the current operator is not the same as the SIM's and it's not in your list, or no-roaming if the current operator matches the SIM's operator. The negative thing is that you'd need to keep track of all national operators and add it to the list if there's some new, but that's something that doesn't happen too often (or at least here).

So basically it would be something like this:

TelephonyManager telephMan = ((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE));

// This will be the current registered operator
String currentOperatorName = telephMan.getNetworkOperatorName();
// This will return the SIM operator
String simOperatorName = telephonyManager.getSimOperatorName();
// Additionally you'll have to keep a list of national operators
ArrayList<String> myCountryOperators = new ArrayList<String();
myCountryOperators.add("...");
myCountryOperators.add("...");
...

if (currentOperatorName.equals(simOperatorName)) {
  // No roaming
}
else if (myCountryOperators.contains(currentOperatorName)) {
  // National roaming
}
else {
  // International roaming
}

其他提示

if it's a GSM phone, in my opinion is easier to compare the country code set in the SIM card with the country code of network carrier with TelephonyManager.getNetworkCountryIso() and TelephonyManager.getSimCountryIso() If they match you're in same country, otherwise don't. And you don't need to keep a list of names...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top