cellular-network

Know if iOS device has cellular data capabilities

时间秒杀一切 提交于 2019-11-29 20:10:22
I have a toggle in my app that's "download on WiFi only". However, that toggle is useless for iPod touch or WiFi-iPads. Is there a way to know if the device has cellular data capabilities in code? Something that would work in the future would be great too (like if an iPod touch 5th gen with 3G comes out). bentech Hi you should be able to check if it has the pdp_ip0 interface #import <ifaddrs.h> - (bool) hasCellular { struct ifaddrs * addrs; const struct ifaddrs * cursor; bool found = false; if (getifaddrs(&addrs) == 0) { cursor = addrs; while (cursor != NULL) { NSString *name = [NSString

iPhone - Track cellular data usage

谁都会走 提交于 2019-11-29 12:11:08
问题 Is there a way to track cellular data usage on iPhone ? There are lot of apps which does the same like 'Dataman' and 'DataUsage' Basically I am looking for a programmatic way to get information stored in Settings -> General -> Usage Any help will be appreciated. 回答1: To check Cellular Network Use this - (bool) hasCellular { struct ifaddrs * addrs; const struct ifaddrs * cursor; bool found = false; if (getifaddrs(&addrs) == 0) { cursor = addrs; while (cursor != NULL) { NSString *name =

How to detect tower changes in Android?

房东的猫 提交于 2019-11-29 07:08:19
Just wanted to know whether it's possible to get cell tower changes in Android? I have seen an event called onCellLocationChanged in PhoneStateListener . Can I use this to detect cell tower changes ? This is the correct method. It is always called if you are in a new cell. See the documentation here: http://developer.android.com/reference/android/telephony/PhoneStateListener.html#onCellLocationChanged(android.telephony.CellLocation ) Glenn This is not true. onCellLocationChanges from PhoneStateListener is ONLY called when the phone is NOT sleeping. You have to wake up the phone (force a

How to check if iPhone supports CDMA or GSM

爷,独闯天下 提交于 2019-11-29 02:45:26
Is there any way to identify if iPhone supports CDMA or GSM network. Any Apple API in Objective-C which can provide this information. You might examine model id with the function ( credits ): #include <sys/types.h> #include <sys/sysctl.h> NSString* machine () { size_t size; // Set 'oldp' parameter to NULL to get the size of the data // returned so we can allocate appropriate amount of space sysctlbyname("hw.machine", NULL, &size, NULL, 0); // Allocate the space to store name char *name = malloc(size); // Get the platform name sysctlbyname("hw.machine", name, &size, NULL, 0); // Place name into

Weird NSURLSessionDownloadTask behavior over cellular (not wifi)

假装没事ソ 提交于 2019-11-28 23:02:52
问题 I've enabled Background Modes with remote-notification tasks to download a small file (100kb) in background when the app receives a push notification. I've configured the download Session using NSURLSessionConfiguration *backgroundConfiguration = [NSURLSessionConfiguration backgroundSessionConfiguration:sessionIdentifier]; [backgroundConfiguration setAllowsCellularAccess:YES]; self.backgroundSession = [NSURLSession sessionWithConfiguration:backgroundConfiguration delegate:self delegateQueue:

Objective-C determine data network type of the iOS device

淺唱寂寞╮ 提交于 2019-11-28 16:21:18
问题 Im on an application that receive data from server, the problem is when user connect to cellular data (Not 3G or WIFI ), it take ages to receive data. i had implemented this code from this Answer but im not sure if it is effective or not, sometimes it's giving me an accurate type, and sometimes it don't. here is my code: - (void)newtworkType { NSArray *subviews = [[[[UIApplication sharedApplication] valueForKey:@"statusBar"] valueForKey:@"foregroundView"]subviews]; NSNumber

Know if iOS device has cellular data capabilities

丶灬走出姿态 提交于 2019-11-28 15:59:13
问题 I have a toggle in my app that's "download on WiFi only". However, that toggle is useless for iPod touch or WiFi-iPads. Is there a way to know if the device has cellular data capabilities in code? Something that would work in the future would be great too (like if an iPod touch 5th gen with 3G comes out). 回答1: Hi you should be able to check if it has the pdp_ip0 interface #import <ifaddrs.h> - (bool) hasCellular { struct ifaddrs * addrs; const struct ifaddrs * cursor; bool found = false; if

Checking cellular network type in iOS

别说谁变了你拦得住时间么 提交于 2019-11-28 11:45:55
I am working on an iOS app, and want to determine which type of cellular connection the device has. I'm most interested in the kind of cellular network my device is using: 2G or 3G, or other. However, the Reachability.h only provides checking for wifi or 3G. How can I check for 2G, 3G, etc? 2G / 3G cannot be distinguished via Reachability.h or any other third party libraries, as iPhone only provides network type information ( WWAN , WiFi , no Network ) to API. However, if you are able to know the IP range of 2G or 3G network, you can determine which network speed / frequency the iPhone is

How to check if iPhone supports CDMA or GSM

独自空忆成欢 提交于 2019-11-27 21:58:26
问题 Is there any way to identify if iPhone supports CDMA or GSM network. Any Apple API in Objective-C which can provide this information. 回答1: You might examine model id with the function (credits): #include <sys/types.h> #include <sys/sysctl.h> NSString* machine () { size_t size; // Set 'oldp' parameter to NULL to get the size of the data // returned so we can allocate appropriate amount of space sysctlbyname("hw.machine", NULL, &size, NULL, 0); // Allocate the space to store name char *name =

Checking cellular network type in iOS

↘锁芯ラ 提交于 2019-11-27 06:30:12
问题 I am working on an iOS app, and want to determine which type of cellular connection the device has. I'm most interested in the kind of cellular network my device is using: 2G or 3G, or other. However, the Reachability.h only provides checking for wifi or 3G. How can I check for 2G, 3G, etc? 回答1: 2G / 3G cannot be distinguished via Reachability.h or any other third party libraries, as iPhone only provides network type information ( WWAN , WiFi , no Network ) to API. However, if you are able to