Open bannostookaylo opened 9 years ago
Might try setting the orientation preference in the config.xml file. Some info here: http://docs.phonegap.com/en/edge/config_ref_index.md.html#The%20config.xml%20File_global_preferences
I was going to look into that but I was worried after running
cca build android --release
It would get over written.
@agrieve
I just tried setting
<preference name="Orientation" value="default" />
in the config.xml and it didn't work. I've double checked that allow screen rotation is enabled on my phone.
So I've narrowed this issue down some... I think it maybe a bug...
Upon opening the App for the first time the screen rotates. Once I close out of it or go to the home page then re-open the app the screen no longer rotates. To get it to rotate again I have to uninstall the app and re-install it. Again, however, it only rotates on the initial opening of the app. Once I navigate away from the app the screen no longer rotates.
I just tried updating to the most recent version as well cca v0.5.1 and am still getting the same screen rotation issues.
FYI, I can rotate in my 7-Inch pad but cant rotate in my MI2 phone. cca 0.5.0. it used to work w/o any problem in cca 0.4.3.
I am developing with a Note 3
For iOS
platform setting Orientation with <preference name="Orientation" value="default"/>
in config.xml
does not have any influence on rotation behavior! The project's PLIST
entries Supported interface orientations
and Supported interface orientations (iPad)
are not set correctly! I have to set all supported interface orientations manually.
And what about Android
? Where do I have to implement interface orientation? Does someone has a working example for me?
Thanks
I am seeing the same issues with iphone and android with cca version 0.5.1
Okay, I'm seeing this too now on Android L.
Oddly, it doesn't appear to happen when an app is deployed to the device, but when starting it from the app list, it doesn't rotate. Pretty consistently reproducable.
Related question on stack overflow: http://stackoverflow.com/questions/28551516/auto-rotate-in-chrome-mobile-apps/28555036#28555036
I've verified the problem on Android, with the latest cca. When the app is started (and not previously running), the screen will not rotate. This applies if the app is started from the home screen, recents, as well as cca run
. If the app is running (i.e. paused), and then resumed, the screen will rotate as expected.
As in the stack overflow question (see earlier comment), the problem is related to the use of the "Translucent" theme. Explicitly setting a non-translucent them (e.g. "Black-NoTitleBar") will correct the problem, and the screen will rotate as expected. We don't have a clear explanation or reason for this behaviour. For example, we haven't identified if this expected vs a bug in Android.
There is another work-around that allows the translucent theme to be used. In the AndroidManifest.xml, the activity can be configured to force screen rotation to be detected/respected. This is done by adding the attribute android:screenOrientation="sensor"
to the affected <activity>
element(s). Unfortunately, if this change is made directly to platforms/android/AndroidManifest.xml, it will be over-written when the app is prepared. In the short-term, a post-prepare hook is required to update the AndroidManifest.xml. See below for a sample script for the post-prepare hook.
Please try one of two workarounds to see if that addresses the problem. We are investigating a fix, so that a workaround is not needed.
Sample post-prepare script (put in an executable file under .../hooks/after_prepare):
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
// no need to configure below
var rootdir = process.argv[2];
var srcfile = path.join(rootdir, 'myAndroidManifest.xml');
var destfile = path.join(rootdir, 'platforms/android/AndroidManifest.xml');
console.log("copying "+srcfile+" to "+destfile);
var destdir = path.dirname(destfile);
if (fs.existsSync(srcfile) && fs.existsSync(destdir)) {
fs.createReadStream(srcfile).pipe(
fs.createWriteStream(destfile));
}
I noticed that after I built my app and uploaded it to the Google Play store my app doesn't rotate on my mobile device. Is there a setting I am missing somewhere?