diff --git a/bin/templates/project/Activity.java b/bin/templates/project/Activity.java
index 567b6c72..29f01f30 100644
--- a/bin/templates/project/Activity.java
+++ b/bin/templates/project/Activity.java
@@ -1,41 +1,61 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-package __ID__;
-
-import android.os.Bundle;
-import org.apache.cordova.*;
-
-public class __ACTIVITY__ extends CordovaActivity
-{
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- // enable Cordova apps to be started in the background
- Bundle extras = getIntent().getExtras();
- if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
- moveTaskToBack(true);
- }
-
- // Set by in config.xml
- loadUrl(launchUrl);
- }
-}
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package __ID__;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+import android.view.KeyEvent;
+
+public class __ACTIVITY__ extends CordovaActivity
+{
+ private static final int[] SCAN_KEYCODE = {520, 521, 522, 523};
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ // enable Cordova apps to be started in the background
+ Bundle extras = getIntent().getExtras();
+ if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
+ moveTaskToBack(true);
+ }
+
+ // Set by in config.xml
+ loadUrl(launchUrl);
+ }
+
+ @Override
+ public boolean onKeyUp(int keyCode, KeyEvent event) {
+ if (keyCode >= SCAN_KEYCODE[0] && keyCode <= SCAN_KEYCODE[SCAN_KEYCODE.length - 1]) {
+ }
+ loadUrl("javascript:cordova.fireWindowEvent('native.onKeyUp',{keycode:"+keyCode+"})");
+ return super.onKeyUp(keyCode, event);
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (keyCode >= SCAN_KEYCODE[0] && keyCode <= SCAN_KEYCODE[SCAN_KEYCODE.length - 1]) {
+ }
+ loadUrl("javascript:cordova.fireWindowEvent('native.onKeyDown',{keycode:"+keyCode+"})");
+ return super.onKeyDown(keyCode, event);
+ }
+
+}