---
title: beginGeneratingDeviceOrientationNotifications()
framework: uikit
role: symbol
role_heading: Instance Method
path: uikit/uidevice/begingeneratingdeviceorientationnotifications()
---

# beginGeneratingDeviceOrientationNotifications()

Begins the generation of notifications of device orientation changes.

## Declaration

```swift
func beginGeneratingDeviceOrientationNotifications()
```

## Discussion

Discussion You must call this method before attempting to get orientation data from the device. This method enables the device’s accelerometer hardware and begins the delivery of acceleration events to the device. The device subsequently uses these events to post orientationDidChangeNotification notifications when the device orientation changes and to update the orientation property. You may nest calls to this method safely, but you should always match each call with a corresponding call to the endGeneratingDeviceOrientationNotifications() method.

## See Also

### Tracking the device orientation

- [orientation](uikit/uidevice/orientation.md)
- [UIDeviceOrientation](uikit/uideviceorientation.md)
- [isGeneratingDeviceOrientationNotifications](uikit/uidevice/isgeneratingdeviceorientationnotifications.md)
- [endGeneratingDeviceOrientationNotifications()](uikit/uidevice/endgeneratingdeviceorientationnotifications().md)
