Giter Club home page Giter Club logo

pg-plugin-screen-orientation's Introduction

Updated to use with Cordova 2.5

Screen Orientation PhoneGap Plugin for Android

This PhoneGap Plugin for Android can lock/unlock the screen orientation.

How to install

  1. Add com/tsukurusha/phonegap/plugins/ScreenOrientation.java to your src folder.

  2. Add the following line to res/xml/plugins.xml. <plugin name="ScreenOrientation" value="com.tsukurusha.phonegap.plugins.ScreenOrientation" />

  3. Add pg-plugin-screen-orientation.js to your assets/www folder and import it into your html file like: <script type="text/javascript" charset="utf-8" src="pg-plugin-screen-orientation.js"></script>

  4. The javascript interface is as follows:

pg-plugin-screen-orientation's People

Contributors

champierre avatar davidshumway avatar justinobney avatar pamepros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pg-plugin-screen-orientation's Issues

Can full senor be used with android 2.2?

Hey,

Going to be using this plugin to be able to lock and unlock orientation. Followed the directions and receiving these errors for the last 5 possible settings in ScreenOrientation.java includeing full sensor

SCREEN_ORIENTATION_FULL_SENSOR cannot be resolved or is not a field

The top 5 have no error.

Thinking maybe sensor_landscape, reverse_portrait, full_sensor ect were not implemented in 2.2?

If this is so, is there a way around it or is something wrong with my code maybe?

Any help would be appreciated. Thanks!

Josh

exec() call to unknown plugin: ScreenOrientation

Hi Guys,

Im using PhoneGap 2.8.1 and I added the necessary files for the plugin, I made some changes as:

Change: PhoneGap.exec (success, fail, "ScreenOrientation", "set", [str]);
To: cordova.exec (null, null, "ScreenOrientation", "set", [str]);

and add a few lines in the file ScreenOrientation.java, and is without error.

But when I make a call using the code below:

$ ('# rotate'). click (function (event) {
navigator.screenOrientation.set ('landscape');
window.weHaveChangedOrientation = true;
});

My console in Eclipse shows the following notification:
Tag: PlugInManager
Text: exec () call to unknown plugin: ScreenOrientation

And does not the screen rotation.

Could anyone help me please.

Broken in Android 4.4 (KitKat)

Using navigator.screenOrientation.set('landscape'); and navigator.screenOrientation.set('portrait'); work as expected, but trying to set navigator.screenOrientation.set('fullSensor'); navigator.screenOrientation.set('sensor'); or navigator.screenOrientation.set('unspecified'); to revert to default behaviour does not work (where it was previously working in Android <= 4.3) and leaves screen locked to either portrait or landscape, whichever was last locked to.

no method 'exec'

I got this error
Uncaught TypeError: Object # has no method 'exec' at file:///android_asset/www/JS/pg-plugin-screen-orientation.js:4

PhoneGap.exec not defined error

Hello,

I am using your plugin with phonegap and Cordova.

I followed your instructions and am getting an error with the .js file at line 4, PhoneGap.exec is not defined.

Could you please advise what the problem could be? Has this feature been depreciated in Cordova?

Thanks

Cannot cast from LegacyContext to Activity

Hi there,

I'm getting an error in ScreenOrientation.java, line 30: Cannot cast from LegacyContext to Activity

The line of code is: Activity activity = (Activity)this.ctx;

Any ideas what I'm doing wrong here? I'm using Cordova 2.0.0, Eclipse 4.2.0 - all the latest versions as far as I know.

Thanks,

David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.