I am trying to achieve the ability to lock the device rotation at certain points in my application, for example menu navigation could be done in both portrait and landscape mode but game play would be only in landscape.
Is there anyway to achieve this currently with PhoneGap? Short of having to brute force detect rotation with jquery etc and counter rotate the page?
It would be nice if their is some api call to lock or unlock rotation.
PS. i am using iOS7 and phonegap 3
Related
After several sleepless nights, I don't have any more ideas how to do what I am trying to do.
In short words, I am trying to allow my fullscreen video to be accessible in all orientations (landscape and portrait). This is the only place in the app where I want to allow that. All other views are locked to portrait.
My idea was to delegate fullscreen enter / exit event and in that place, programmatically set orientation allowance, so on fullscreen enter, unlock landscape additionally and on fullscreen exit, lock back only to portrait. Everything works fine apart from the one crucial part...I can not delegate fullscreen enter/exit event (delegating those events was my idea but I might be completely wrong and that should be managed in completely different way)
I am using this library: https://github.com/brentvatne/react-native-video
Thanks in advance for any help!
I'm implementing an app that needs a camera preview using AVCaptureSession. Unfortunately iOS9 will interrupt the AVCaptureSession as soon as Split View or Slide Over is on. The system allows to detect such an interruption (see: https://stackoverflow.com/a/33086527/1896336).
The good thing is that we can warn the user to go Full Screen but I was actually wondering if we could programmatically set the app to go Full Screen when the user taps a "yes take me back to full screen" button ?
No. If you don't like this behavior, don't use iPad Multitasking (opt out by insisting on full screen in the Info.plist).
I need to track device orientation even though device orientation is locked to Portrait mode. What I really need is to accomplish similar behaviour to what Instagram camera view has: when you rotate device, it will rotate buttons over camera view, even when your device is locked.
I used to track orientation with UIDeviceOrientationDidChangeNotification, but that is not fired when device orientation is locked :(
Is there perhaps implementation somewhere using accelerometer and/or gyroscope? I'm suprised I couldn't find something like that.
Use the accelerometer to detect device orientation yourself. You can use the Core Motion framework to get the data you need. There's a sample snippet in the linked docs that shows how to get the data. Use a low-pass filter to isolate the force of gravity from relatively short-term changes due to user movement. Apple has a sample project called AccelerometerGraph that demonstrates this.
At the moment i am developing a small web application which is based on swipe and for example when i swipe it to right on my iPad or iPod the screen also goes to right. Is it possible somehow to lock screen?
You could download the jquery Dialog plug-in, http://jqueryui.com/dialog/ and set a condition for it to pop up, and also a message stating that the screen is currently locked. This is probably one of the cleanest ways of controlling your screen in regards to users proceeding or staying.
i develop application for Blackberry. In Storm 1 (4.7) and Storm 2 (5.0) i need to disable accelerometer in my application. I want my application does not react to the accelerometer, but that does not affect other applications. Its possible?
There is no way to disable accelerometer but you can lock screen orientation change:
// To force portrait view in a BlackBerry API application,
// use code like this before invoking UiApplication.pushScreen()
int directions = Display.DIRECTION_NORTH | Display.DIRECTION_SOUTH;
Ui.getUiEngineInstance.setAcceptableDirections(directions);
See Specifying the orientation and direction of the screen