I need get the device orientation(portrait, upsidedown, landscapeleft, landscaperight) after the app enter background and then send it to another device through Bluetooth. [UIDevice currentDevice].orientation not working in background mode. Is there any way I can do this?
1
votes
1 Answers
0
votes
There is a private method called -[UIApplication _getSpringBoardOrientation]
which just calls another private method -[UIApplication activeInterfaceOrientation]
, which seems to give you the orientation of the current foreground app.
But as of my knowledge I do not think that it will capture orientation changes in background because UIDevice class not work like that. But you can do capture the last state of orientation when your application enters in the background using
Objective-C
-(void)applicationDidEnterBackground:(UIApplication *)application
Swift
func applicationDidEnterBackground(application: UIApplication)