Meteor Cordova Orientation

2019-08-06 00:36发布

问题:

I am attempting to lock the orientation of the meteor cordova build to portrait mode.

I have set up a top-level file called mobile-config.js

In that file I included:

App.setPreference('Orientation', 'portrait');

This seems to have no effect, it still switches to landscape mode. Does anyone know how I could implement portrait lock? Thanks!

回答1:

It appears to be an open bug, check this answer here and the bug itself here.

Apparently the simplest way is to edit the Manifest.xml file directly (what comes out of the meteor build command), but I'd use a plugin to avoid having to edit files manually after each build.

Bottom line, to fix it, wait for an official bug fix or meanwhile use a plugin.



回答2:

Not sure if you have fixed it yet. I had a similar issue and resolved it for android app. Please note this solution has been tested for Meteor running on android device using:meteor run android-device. Meteor version is 1.3, also works on 1.3.1. Just stop your meteor server, uninstall the app from android device. Then inside the meteor project directory, meteor reset. Then meteor run android-device.

Let me know if this helps.