gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 02:19:07 24 4
gpt4 key购买 nike

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

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

有机会实现这个结果吗?

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

最佳答案

I ran into this problem a while back ,我设法找到了一种适合我的目的的方法。它不漂亮,也不是 future 的证据,也没有记录。但我目前在 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 问题......:)

关于android - 查找正在使用的运营商信息,而不是 SIM 卡信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28396220/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com