Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
173 views
in Technique[技术] by (71.8m points)

ios - Measuring cellular signal strength

I am developing a non-appstore app for iOS. I want to read the cellular signal strength in my code.

I know Apple doesn't provide any API by which we can achieve this.

Is there any private API that can be used to achieve this? I have gone through the various threads regarding this issue but could not find any relevant info.

It is completely possible because there is an app in the app-store for detecting the carrier's signal strength.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Get signalStreght IOS9:

UIApplication *app = [UIApplication sharedApplication];  
NSArray *subviews = [[[app valueForKey:@"statusBar"]     valueForKey:@"foregroundView"] subviews];  
NSString *dataNetworkItemView = nil;  
     for (id subview in subviews) {  
   if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarSignalStrengthItemView") class]])  
   {  
        dataNetworkItemView = subview;  
        break;  
    }  
 }  
int signalStrength = [[dataNetworkItemView valueForKey:@"signalStrengthRaw"] intValue];  
NSLog(@"signal %d", signalStrength);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...