title: Detecting android softkeyboard show/hide events
body: <p>I am trying to detect <code>showKeyboard</code> and <code>hidekeyboard</code> events on phonegap. For that purpose, on <code>deviceready</code> event I placed following code:</p>
  <pre><code>  bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
  },
  // deviceready Event Handler
  //
  // The scope of 'this' is the event. In order to call the 'receivedEvent'
  // function, we must explicity call 'app.receivedEvent(...);'
  onDeviceReady: function() {
      document.addEventListener(&quot;menubutton&quot;,app.onMenuKeyPress,false);
      document.addEventListener(&quot;backbutton&quot;,navigateBack,false);
      document.addEventListener(&quot;hidekeyboard&quot;, onKeyboardHide, false);
      document.addEventListener(&quot;showkeyboard&quot;, onKeyboardShow, false);
  },
  </code></pre>
  <p>Here <code>backbutton</code>event is being fired and working fine but <code>hidekeyboard</code> and <code>showkeyboard</code> events are never fired.</p>
  <p>Also to detect it I tried to use <code>window.onresize</code> event, that worked in browser. Following is  its code:</p>
  <pre><code>window.onresize = function(){
      var screenHeight = $(window).height();
      alert(screenHeight);
      var diff = screenInitialHeight - screenHeight;
      var newHeight = screenInitialHeight-diff;
      alert(newHeight);
      $('#mainpage').height(newHeight);
      $('#nav_container').height(newHeight);
  }
  </code></pre>
  <p>But this code also didn't executed on show or hide keyboard. This function is only executing when first time app. is started.  I saw at some places that for some people these events are working so I think there is some thing wrong from my side, probably in some config file etc. So following is androidmanifest.xml code:</p>
  <pre><code>    &lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;manifest android:hardwareAccelerated=&quot;true&quot; android:versionCode=&quot;1&quot; android:versionName=&quot;1.0.0&quot; android:windowSoftInputMode=&quot;adjustPan&quot; package=&quot;com.phonegap.move_custom&quot; xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
      &lt;supports-screens android:anyDensity=&quot;true&quot; android:largeScreens=&quot;true&quot; android:normalScreens=&quot;true&quot; android:resizeable=&quot;true&quot; android:smallScreens=&quot;true&quot; android:xlargeScreens=&quot;true&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;application android:debuggable=&quot;true&quot; android:hardwareAccelerated=&quot;true&quot; android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot; android:largeHeap=&quot;true&quot;&gt;
          &lt;activity android:configChanges=&quot;keyboardHidden|keyboard|screenSize|locale&quot; android:label=&quot;@string/app_name&quot; android:name=&quot;move_custom&quot; android:screenOrientation=&quot;portrait&quot; android:theme=&quot;@android:style/Theme.Black.NoTitleBar&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
      &lt;uses-feature android:name=&quot;android.hardware.camera&quot; android:required=&quot;false&quot; /&gt;
      &lt;uses-sdk android:minSdkVersion=&quot;10&quot; android:targetSdkVersion=&quot;17&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.RECORD_VIDEO&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
      &lt;uses-feature android:name=&quot;android.hardware.camera&quot; /&gt;
      &lt;uses-feature android:name=&quot;android.hardware.camera.autofocus&quot; /&gt;
  &lt;/manifest&gt;
  </code></pre>
  <p>Please let me know if anything need to be chagned. Also if these events are working in someone's app, then please share your app. so that I can try to check configuration and code that why it isn't working in my app. All good efforts will be appreciated. Seems like I am already near but missing something. So anything you can tell will probably be helpful.</p>
  <pre><code>    @Override
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      
      if (getResources().getConfiguration().orientation == 2) {
          super.setIntegerProperty(&quot;splashscreen&quot;, R.drawable.splash);
      }
      else {
          super.setIntegerProperty(&quot;splashscreen&quot;, R.drawable.splashportrait);
      }
      
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
  
      super.loadUrl(Config.getStartUrl(), 3000);
  }
  </code></pre>