Comments (7)
I also tried changing this to Cordova.exec and same error.
from pg-plugin-screen-orientation.
The plugin should work with Cordova.
From the error message, I guess that probably you have not imported cordova.js.
Do you import cordova.js in your html by doing as follows?
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>from pg-plugin-screen-orientation.
Thank you for the reply.
Yes I have Cordova installed. I am using a fully functioning Cordova app. The app will not work once I install your plugin. I am also testing this directly onto a device, no virtual machine. Have you tested this new version in a development environment yet ? I spent hours trying to get this plugin to work with no success.
Perhaps you have a fully working demo?
Thank you.
from pg-plugin-screen-orientation.
I am also having this issue both on a virtual android device and directly on a Galaxy Nexus that I am using to test my app. I am using cordova version 1.9.0 and I am importing it before the screen orientation plugin.
The error being reported is as follows...
07-10 18:30:24.118: E/Web Console(6437): Uncaught TypeError: Object # has no method 'exec' at file:///android_asset/www/pg-plugin-screen-orientation.js:4
from pg-plugin-screen-orientation.
The same error message appears for me also. The problem isn't the fact that I have misplaced files, because I can successfully deploy the landscape mode in for one on my views (the problem then being that every view after that is in landscape). So to fix this I tried to add for the next view portrait mode and ended up having a non working application with the mentioned error message.
08-09 12:44:02.300: D/CordovaLog(26237): file:///android_asset/www/lib/pg-plugin-screen-orientation.js: Line 4 : Uncaught TypeError: Object # has no method 'exec'
in the js file I tried both
cordova.exec(null, null, "ScreenOrientation", "set", [str]); and
PhoneGap.exec(success, fail, "ScreenOrientation", "set", [str]);
as possible solutions, but still crashing
from pg-plugin-screen-orientation.
Ha. Found a workaround.
The problem was that if the orientation change is fired too early, (for me the first view) it blows up the whole application. For me the fix was that I needed the landscape in a view that is deployed much later, so the fix was:
the view that needs to be landscape
navigator.screenOrientation.set('landscape');
window.weHaveChangedOrientation = true;
and then in the first view
if (window.weHaveChangedOrientation) {
navigator.screenOrientation.set('portrait');
}
so only force portrait if landscape has been forced earlier.
from pg-plugin-screen-orientation.
and remember to listen to the
document.addEventListener("deviceready", function(){
whatever
}, false);
to avoid problems I had :P
from pg-plugin-screen-orientation.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pg-plugin-screen-orientation.