Questions tagged [uidevice]

The UIDevice class provides a singleton instance representing the current device. From this instance you can obtain information about the device such as assigned name, device model, and operating-system name and version. Available in iOS 2.0 and later

UIDevice instance is used to detect changes in the device’s characteristics, such as physical orientation. You get the current orientation using the orientation property or receive change notifications by registering for the UIDeviceOrientationDidChangeNotification notification. Before using either of these techniques to get orientation data, you must enable data delivery using the beginGeneratingDeviceOrientationNotifications method.

When you no longer need to track the device orientation, call the endGeneratingDeviceOrientationNotifications method to disable the delivery of notifications.

Source: UIDevice Class reference

Related tag:

Related SO Questions:

174 questions
4
votes
2 answers

What is the best way to get the current orientation for setting views

I want to detect the current orientation for setting the view, which will be the better way for it from the below methods and how ? [[UIDevice currentDevice]orientation] [[UIApplication sharedApplication] statusBarOrientation]
user2234547
4
votes
1 answer

How to exactly detect iDevice model?

I want to detect what iDevice the user has and then put the device name in a UILabel. With the following code the App detects only the iPhone/iPad/iPod I like to have iPhone 4/iPod 3G/iPad 1G... or the exact names (iPhone 3.1/iPod 2.0/ iPad…
David Gölzhäuser
  • 3,525
  • 8
  • 50
  • 98
4
votes
5 answers

How to obtain extensive battery info in iOS?

I'm wondering is it possible to receive information about battery like: capacity (mA), voltage (V), cycle count within iOS? I know UIDevice class, but battery level is not what I'm looking for.
Wojciech Rutkowski
  • 11,299
  • 2
  • 18
  • 22
4
votes
1 answer

Restrict the iphone app to install on only devices with Retina Display (iphone 4 / 4S )

I am developing one iphone app. But I want to restrict my app to install only on device swith Retina Display. So my decision is to add UIRequiredDeviceCapabilities key in plist file with front facing camera required so that my app will install on…
iOSAppDev
  • 2,755
  • 4
  • 39
  • 77
3
votes
1 answer

Can I recognize if current iOS device is used for development?

He All, While I write my apps I thought maybe I could recognize if one of my future app users is a iOS developer. For example check if the current device have any developer certificate installed?
sy77
  • 31
  • 3
3
votes
2 answers

iOS: Monitoring Battery Level uses more battery? Should auto-save?

I have a GPS app that already uses a fair amount of battery. Because of the nature of the app, I don't want the user to loose all of their data if their battery dies without them knowing it. So, I figured I would monitor the battery and then save…
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
3
votes
1 answer

Why Apple Created isBatteryMonitoringEnabled?

To monitor battery state and level, app should first enable isBatteryMonitoringEnabled property and set it true. But why this property created? You can set it to false or true wherever you want and system does not interfere in monitoring ever. Is…
rick
  • 1,009
  • 2
  • 10
  • 28
3
votes
1 answer

iPhone 4 incorrect screen size?

Could someone tell me why the following code would return Screen Size: 320.000000, 480.000000 on the iPhone 4? CGRect screenRect = [[UIScreen mainScreen] bounds]; NSLog(@"Screen Size: %f, %f", screenRect.size.width, screenRect.size.height);
carloe
  • 1,440
  • 3
  • 18
  • 26
3
votes
0 answers

UIDevice batteryLevel method gives wrong value of battery in background?

My application supports background mode [location service], in background application will continuously communicate with Web-server and it will send device battery with other details. I found that when application is in background at that time …
Vishwa Patel
  • 484
  • 2
  • 10
3
votes
3 answers

takeScreenshot always returns false for uiautomator

I am trying to automate 'taking a screenshot' on Galaxy S4 and Kindle HDX 8.9 and I am using the following code. if(!(getUiDevice().takeScreenshot(new File("ANYPATH")))) System.out.println("False: Screenshot not taken!!"); else …
rumit patel
  • 1,891
  • 5
  • 23
  • 28
3
votes
1 answer

Monitor the current going into iPhone or iPad when charging

Is there a way to see the levels of current that are going into the iPhone or iPad when it is charging? I know of some code that allows you to see the level at which the battery is charged but I'd like to be able to see the current that is going…
uplearned.com
  • 3,393
  • 5
  • 44
  • 59
3
votes
2 answers

Alternative to [UIDevice currentDevice].identifierForVendor

I have one product that has two different applications. and both the applications it gives me different Identifiers for the same device (you would assume that apple would associate this to maybe your developer account so that you can reuse the…
Jonathan
  • 2,728
  • 10
  • 43
  • 73
3
votes
1 answer

UIDevice CFDictionaryGetValue error in background

I am checking: [[UIDevice currentDevice] systemName] in applicationDidEnterBackground. It is causing a EXC_BAD_ACCESS (SIGSEGV) signal. The stack trace shows that this is occurring internally in UIDevice, which is calling…
2
votes
0 answers

How to get platform of the current device?

Is there a way to get the current platform of the device? I'm hoping for a better way than to do something like this: let platform: String #if os(iOS) platform = "iOS" #elseif os(watchOS) platform = "watchOS" #elseif os(tvOS) platform =…
TruMan1
  • 33,665
  • 59
  • 184
  • 335
2
votes
0 answers

Espresso UiObject.click() on the app to resume from recent apps

I'm trying to make an espresso UI test for android application which check whether the session is still exist after background the app and foreground it again I tried to use that code val device = UiDevice.getInstance(getInstrumentation()) …
1 2
3
11 12