このエラーが発生しています。
キャッチされていない TypeError: Object # has no method 'exec' at file:///android_asset/www/JS/pg-plugin-screen-orientation.js:4
var screenOrientation = function() {}
screenOrientation.prototype.set = function(str, success, fail) {
PhoneGap.exec(success, fail, "ScreenOrientation", "set", [str]); // GETTING ERROR IN THIS LINE
};
navigator.screenOrientation = new screenOrientation();
このドキュメントに記載されている手順に従いました。 https://github.com/champierre/pg-plugin-screen-orientation
今では正常に動作しています。しかし、この行が実行されるとアプリケーションがクラッシュします
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
07-24 18:01:19.200: E/AndroidRuntime(12001): FATAL EXCEPTION: main
07-24 18:01:19.200: E/AndroidRuntime(12001): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@4054e820 is not valid; is your activity running?
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.view.ViewRoot.setView(ViewRoot.java:527)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.view.Window$LocalWindowManager.addView(Window.java:424)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.app.Dialog.show(Dialog.java:241)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
07-24 18:01:19.200: E/AndroidRuntime(12001): at org.apache.cordova.Notification$1.run(Notification.java:205)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.app.Activity.runOnUiThread(Activity.java:3717)
07-24 18:01:19.200: E/AndroidRuntime(12001): at org.apache.cordova.Notification.alert(Notification.java:208)
07-24 18:01:19.200: E/AndroidRuntime(12001): at org.apache.cordova.Notification.execute(Notification.java:70)
07-24 18:01:19.200: E/AndroidRuntime(12001): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:212)
07-24 18:01:19.200: E/AndroidRuntime(12001): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:185)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:566)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.os.Looper.loop(Looper.java:123)
07-24 18:01:19.200: E/AndroidRuntime(12001): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-24 18:01:19.200: E/AndroidRuntime(12001): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 18:01:19.200: E/AndroidRuntime(12001): at java.lang.reflect.Method.invoke(Method.java:507)
07-24 18:01:19.200: E/AndroidRuntime(12001): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-24 18:01:19.200: E/AndroidRuntime(12001): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-24 18:01:19.200: E/AndroidRuntime(12001): at dalvik.system.NativeStart.main(Native Method)