diff --git a/native/templates/js-template-binary/cocos-project-template.json b/native/templates/js-template-binary/cocos-project-template.json index 7616afd4dc..b6d721e378 100755 --- a/native/templates/js-template-binary/cocos-project-template.json +++ b/native/templates/js-template-binary/cocos-project-template.json @@ -119,11 +119,6 @@ "to": "" }, "modify_files": [ - { - "file_path": "config.json", - "pattern": "\\\"isLandscape\\\"\\s*:.*,", - "replace_string": "\"isLandscape\": false," - }, { "file_path": "main.js", "pattern": "setDesignResolutionSize\\(\\s*(\\d+),\\s*(\\d+),(.*)\\)", diff --git a/native/templates/js-template-binary/frameworks/runtime-src/proj.android/jni/hellojavascript/main.cpp b/native/templates/js-template-binary/frameworks/runtime-src/proj.android/jni/hellojavascript/main.cpp index c721da8a60..0722a7e751 100755 --- a/native/templates/js-template-binary/frameworks/runtime-src/proj.android/jni/hellojavascript/main.cpp +++ b/native/templates/js-template-binary/frameworks/runtime-src/proj.android/jni/hellojavascript/main.cpp @@ -18,11 +18,6 @@ void cocos_android_app_init (JNIEnv* env) { extern "C" { - bool Java_org_cocos2dx_javascript_AppActivity_nativeIsLandScape(JNIEnv *env, jobject thisz) - { - return SimpleConfigParser::getInstance()->isLanscape(); - } - bool Java_org_cocos2dx_javascript_AppActivity_nativeIsDebug(JNIEnv *env, jobject thisz) { #if (COCOS2D_DEBUG > 0) diff --git a/native/templates/js-template-binary/frameworks/runtime-src/proj.android/src/org/cocos2dx/javascript/AppActivity.java b/native/templates/js-template-binary/frameworks/runtime-src/proj.android/src/org/cocos2dx/javascript/AppActivity.java index c1ec91b5eb..5f065885bb 100755 --- a/native/templates/js-template-binary/frameworks/runtime-src/proj.android/src/org/cocos2dx/javascript/AppActivity.java +++ b/native/templates/js-template-binary/frameworks/runtime-src/proj.android/src/org/cocos2dx/javascript/AppActivity.java @@ -45,12 +45,7 @@ public class AppActivity extends Cocos2dxActivity{ protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); - - if(nativeIsLandScape()) { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); - } else { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); - } + if(nativeIsDebug()){ getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } @@ -76,8 +71,7 @@ public class AppActivity extends Cocos2dxActivity{ public static String getLocalIpAddress() { return hostIPAdress; } - - private static native boolean nativeIsLandScape(); + private static native boolean nativeIsDebug(); }