查找正在使用的运营商信息,而不是SIM卡信息



是否可以获取有关当前使用的运营商的信息?CoreTelefony提供有关SIM卡运营商的信息。

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

有机会达到这个结果吗?

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

我不久前遇到了这个问题,我设法找到了一种适合我的方法。它不漂亮,也不经得起未来的考验,也没有记录在案。但我目前在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>国家/地区词典和一本MNC>网络词典来检查这些代码代表

不过无法帮助您使用安卓系统..:)

最新更新