iOS detect if user is on an iPad

There are quite a few ways to check if a device is an iPad. This is my favorite way to check whether the device is in fact an iPad: if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) { return YES; /* Device is iPad */ } The way I use it #define IDIOM UI_USER_INTERFACE_IDIOM() #define IPAD UIUserInterfaceIdiomPad … Read more

How to detect a mobile device with JavaScript?

I know this answer is coming 3 years late but none of the other answers are indeed 100% correct. If you would like to detect if the user is on ANY form of mobile device (Android, iOS, BlackBerry, Windows Phone, Kindle, etc.), then you can use the following code: if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) { // … Read more

Get Android Phone Model programmatically , How to get Device name and model programmatically in android?

I use the following code to get the full device name. It gets model and manufacturer strings and concatenates them unless model string already contains manufacturer name (on some phones it does): public String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.toLowerCase().startsWith(manufacturer.toLowerCase())) { return capitalize(model); } else { return capitalize(manufacturer) + … Read more

Detect the specific iPhone/iPod touch model [duplicate]

You can get the device model number using uname from sys/utsname.h. For example: #import <sys/utsname.h> NSString* machineName() { struct utsname systemInfo; uname(&systemInfo); return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; } The result should be: @”i386″ on the simulator @”iPod1,1″ on iPod Touch @”iPod2,1″ on iPod Touch Second Generation @”iPod3,1″ on iPod Touch Third Generation @”iPod4,1″ on iPod Touch … Read more

How to determine the current iPhone/device model?

I made this “pure Swift” extension on UIDevice. If you are looking for a more elegant solution you can use my ยต-framework DeviceKit published on GitHub (also available via CocoaPods, Carthage and Swift Package Manager). Here’s the code: import UIKit public extension UIDevice { static let modelName: String = { var systemInfo = utsname() uname(&systemInfo) … Read more