0

Is there any method you can call in HTML5/javaScript that will force the on-screen keyboard to appear in iOS/Android?

I am not looking for an HTML5 keyboard, but simply to notify the device that it needs to display the internal on-screen keyboard.

Thanks

Brad
  • 1,357
  • 5
  • 33
  • 65
  • 2
    What is the keyboard for? iOS will automatically show the keyboard if a text field has the focus, and hide it otherwise. – Marcus Adams Aug 08 '13 at 13:39
  • In this case, the user has connected a Bluetooth barcode scanner, which iOS recognizes as a keyboard, and thus, minimizes the on-screen keyboard by default. – Brad Aug 09 '13 at 16:27
  • 1
    Here's the iOS Solution: [Show iphone soft keyboard even though a hardware keyboard is connected](http://stackoverflow.com/questions/3326189/show-iphone-soft-keyboard-even-thought-a-hardware-keyboard-is-connected/3837131#3837131) – Marcus Adams Aug 09 '13 at 17:36
  • Marcus, thanks for the link. Looks like exactly what I was searching for. – Brad Aug 15 '13 at 21:10

1 Answers1

0

For Android you can use this:

 public void showSoftKeyboard(View v) {
        Activity activity = (Activity) v.getContext();
        InputMethodManager inputMethodManager = (InputMethodManager)  activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputMethodManager.showSoftInput(activity.getCurrentFocus().getWindowToken(), 0);
    }

OR just call:

((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);

For iOS I found this one:

$('#element').focus().blur().focus();
g00dy
  • 6,752
  • 2
  • 30
  • 43