Giter Site home page Giter Site logo

Comments (2)

dconlisk avatar dconlisk commented on July 1, 2024

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.

davidshumway avatar davidshumway commented on July 1, 2024

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 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.