Comments (2)
OK I got this to work with a few changes:
replace line
Activity activity = (Activity)this.ctx;
with
Activity activity = cordova.getActivity();
in ScreenOrientation.java (line 30).
Replace the javascript call to PhoneGap.exec with
cordova.exec(null, null, "ScreenOrientation", "set", [str]);
Note that the first two parameters are callback functions, which I'm not using, which is why I'm passing null for those parameters.
Cheers,
David
from pg-plugin-screen-orientation.
Thanks to dconlisk
For use with Cordova 2.5.0
Note that the following require API level 9:
android.content.pm.ActivityInfo#SCREEN_ORIENTATION_REVERSE_LANDSCAPE
android.content.pm.ActivityInfo#SCREEN_ORIENTATION_FULL_SENSOR
android.content.pm.ActivityInfo#SCREEN_ORIENTATION_SENSOR_LANDSCAPE
android.content.pm.ActivityInfo#SCREEN_ORIENTATION_SENSOR_PORTRAIT
android.content.pm.ActivityInfo#SCREEN_ORIENTATION_REVERSE_PORTRAIT
File: ScreenOrientation.java
Change:
import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult;
To:
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
Change:
Activity activity = (Activity)this.ctx;
To:
Activity activity = cordova.getActivity();
File: pg-plugin-screen-orientation.js
Change:
PhoneGap.exec(success, fail, "ScreenOrientation", "set", [str]);
To:
cordova.exec(null, null, "ScreenOrientation", "set", [str]);
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.