【问题标题】:Find carrier info in use, not the SIM one查找正在使用的运营商信息,而不是 SIM 卡
【发布时间】:2015-04-08 09:25:30
【问题描述】:

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

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

有没有机会达到这个结果?

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

【问题讨论】:

    标签: android ios core-telephony carrier


    【解决方案1】:

    I ran into this problem a while back,我设法找到了一种适合我目的的方法。它不漂亮,也不是未来的证明,它也没有记录。但我目前在 AppStore 中有一个使用它的应用程序。

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

    是的,对于 iOS,我知道可以找到 MMC and 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 > 网络字典即可检查这些代码代表什么

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

    【讨论】:

    • 很有用,有没有办法找到国家代码ISO?
    • @user915829 我认为您需要自己查找或制作 MCC/MNC 字典:国家 ISO...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-20
    • 2015-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多