cordova-plugin-screen-orientation does not work
I need help from someone! I try use the plugin above with code: `function fixpositionscreen(){ try{ alert('trying...'); if (screen.orientation.lock('portrait-primary')) { alert('yes, it was blocked');} else {alert('no, it was not blocked....');} } catch(err){ alert(err); } } fixpositionscreen();
So, I receive message saying: "yes, it was blocked' but the screen is not locked. I can still turn the device to either side. The screen continues to reposition. Help me. PS: SO is Android Android Version 5.1 Cordova/Phonegap version 8.0 Using phonegap serve command for provider server of application for the device
Cordova/Phonegap version 8.0
Cordova and Phonegap are different things nowadays. If you have a problem using the Phonegap CLI, you will have to debug this with the Phonegap people.
Using phonegap serve command for provider server of application for the device
What does that mean?
Can you recreate the problem just using Cordova in a new app started with cordova create?
janpio... I made a new project with commands only in phonegap, except to add the screen-orientation plugin, because if I put: phonegap plugin add phonegap-plugin-screen-orientation, CLI returns error (I understood that Phonegap itself does not have this plugin to install) then I used: phonegap plugin add cordova-plugin-screen-orientation and it worked, it installed.
PS: Even before installing the plugin-screen-orientation, the try ... catch block already worked, saying that the screen was blocked, it did not give an error saying that the screen.orientation lock () function did not exist. Interesting. But both before and after installing the plugin, the same thing remains, it shows that the screen / command was accepted, but the screen lock does not happen and it is still possible to rotate.
That unfortunately doesn't help. Please try to recreate using Cordova CLI. If you have the error then, put the project on Github so we can take a look.
Closing as stale