Synchromation - Code

Detecting if an iPhone can Mutlitask

Whilst iOS 4 can be installed on a wide variety of devices, not all of the functionality will be available on all devices. One example is that multi-tasking (which is key to allowing the latest generation of radio streaming apps to play audio in the background) is not available on the iPhone 3G (although it is available on the iPhone 3GS & iPhone 4).

To correctly detect whether multitasking is available, we need first to check if iOS 4 (or above) is running on the iPhone, which can be done by detecting the currentDevice supports to the isMultitaskingSupported method. If successful, the presence of multi-tasking can be determined by calling that method.

// Detect if the iOS version is >= iOS 4.0 and the device supports multitasking
if ([[UIDevice currentDevice] respondsToSelector: @selector(isMultitaskingSupported)]
&& [[UIDevice currentDevice] isMultitaskingSupported] == TRUE) {
NSLog (@"Multitasking capable device detected");
}
else {
NSLog (@"Non-multitasking capable device detected");
}


Comments