How to show keyboard on input focus in android?


#1

I have used CrossWalk chromeview on Android. Keyboard showing on input focus works fine on ios but doesn’t work on android. I have tried almost every options I could find. Since I am an android programmer, I edited java files and tried many possible solutions from stackoverflow.

I am using javascript to focus an input box.

I also tried solution pointed out here.

None of these works for me.

Has anyone solved this problem? Please help me its been a nightmare.


#2

There is the ionic keyboard plugin for cordova/phonegap, where you get keyboard access to hide/show the keyboard manually.

Plugin:
https://build.phonegap.com/plugins/944
Source code:


Documentation:
http://ionicframework.com/docs/api/page/keyboard/


#3

I have tried those plugins. There are methods to hide keyboard but not for showing.

Methods

cordova.plugins.Keyboard.hideKeyboardAccessoryBar
cordova.plugins.Keyboard.close
cordova.plugins.Keyboard.disableScroll

Properties

cordova.plugins.Keyboard.isVisible


#4

Try to use a “click” on the input-field instead of focus.

Maybe that works.


#5

Hi,

I forked the ionic keyboard project and added a Keyboard.show() method to it for those cases that an auto focus does not pop up a keyboard on Android devices. You can find it here:

I also sent a pull request to the Ionic guys to potentially update the official plugin


#6

Thanks for your reply but it didn’t work.


#8

Did you uninstall the original keyboard plugin before trying the fork?


#9

It worked thank you very much


#10

I tried that plugin but it did not work. Do I have to fork, or just use a zip file, or even install the plugin with command?


#11

Can you suggest how this gets added into the app? From another post i tried simple using:
cordova plugin add https://github.com/basvanbeek/ionic-plugins-keyboard.git
to add to my app. this does add a plugins/com.ionic.keyboard folder.
but then how to add into app. from another post i found all that was needed was to add:
cordova.plugins.Keyboard.show();
in my $ionicPlatform.ready(function() {}; but when i do this all i get is console is “cordova is not defined”

any hints?


#12

did you include “cordova.js” in your index.html file?
you need to add “ngCordova” as module dependency in your app


#13

Annnd you are testing on mobile devices?
With a built app?

Then something else goes wrong when “cordova” or “window.cordova” is not defined.

And like @blablapolicja wrote -> you have to include the dependencies in your app.


#14

Is there any way to display the keyboard with a specific input type? cordova.plugins.Keyboard.show() only displays alphanumeric. How about number or tel?


#15

Keyboard.show() is not supported by iOS?

from documentation:


cordova.plugins.Keyboard.show();

Supported Platforms
Android, Blackberry 10


#16

hm… I have tried this method on ios, seems didn’t worked.


#17

Cordova comes with a config for this; Just add it to the config.xml file at the root of the project and you should be good to go:

<preference name="KeyboardDisplayRequiresUserAction" value="false" />


#18

Note that <preference name="KeyboardDisplayRequiresUserAction" value="false" /> only applies to iOS, not Android. InAppBrowser version 1.7.2-dev.

Preferences: https://cordova.apache.org/docs/en/latest/config_ref/index.html#preference
InAppBrowser: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/