0

是否可以获得有关当前使用的运营商的信息?CoreTelefony 会返回有关 SIM 运营商的信息。

我在互联网上没有找到任何关于这个话题的文章。由于用户在其他国家移动时SIM卡也可以相同,因此我想检查手机当前使用的网络信息。

有机会达到这个结果吗?

我对 iOS 和 Android 代码都感兴趣。

4

1 回答 1

1

不久前我遇到了这个问题,我设法找到了一种适合我目的的方法。它不漂亮,也不是未来的证明,它也没有记录。但我目前在 AppStore 中有一个使用它的应用程序。

哦,它只在 iOS 7.0 - 8.2 上测试过!

所以是的,对于 iOS,我知道可以找到MMC 和 MNC,这样你就可以找到国家和提供商:

// This is the location of the operator symlink
static NSString * operatorPListSymLinkPath = @"/var/mobile/Library/Preferences/com.apple.operator.plist";

// Here we get the path where the symlink points to
NSFileManager * fileManager = [NSFileManager defaultManager]
NSError * error;
NSString * operatorPListPath = [fileManager destinationOfSymbolicLinkAtPath:operatorPListSymLinkPath error:&error];

运营商路径包含几个数字,其中前 3 个是提供商的 MCC(移动国家代码),后面的几个是 MNC(移动网络代码)

我只是想找到国家(MCC),所以我用了这个:

operatorPListPath = [operatorPListPath stringByTrimmingCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:@"1234567890"] invertedSet]];
NSString * countryMCC = [operatorPListPath substringToIndex:3];

您只需要一个 MCC > Country 字典和 MNC > Network 字典来检查这些代码代表什么

虽然无法帮助您使用Android.. :)

于 2015-02-08T16:40:04.543 回答