0

For a research project, I'm developing an android chat application. For this, it is crucial that all users of the application should use the same, modified keyboard.

My question is the following: Is it possible to deliver a soft keyboard like the simple-keyboard (https://github.com/rkkr/simple-keyboard) with the application? Or alternatively, is it possible to force the user to utilize a certain keyboard for the text input?

Thanks in advance.

Jan
  • 9
  • Related: [detecting the keyboard type](https://stackoverflow.com/q/14370882/589259). Forcing users to use a specific keyboard type doesn't seem all that user friendly and I suppose that Google would go out of their way to prevent that. There are certainly ways to indicate for your input field what kind of input is *intended* (numbers, phone numbers) but that's not the same... – Maarten Bodewes Dec 09 '19 at 12:19

1 Answers1

1

It isn't possible to force a keyboard in a non rooted phone, since there's a security block. You can however ask the user to select your keyboard as in Robert's answer:

InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();

And yes, you can add it in your application, you just need to add the keyboard code within your app, take a look a this question to see how to make a keyboard. But the most important part probably is the Manifest, because it is what will make your application show in the input method picker:

Code by Suragch:

<manifest ...>
    <application ... >
        <activity ... >
            ...
        </activity>

        <service
            android:name=".MyInputMethodService"
            android:label="Keyboard Display Name"
            android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod"/>
            </intent-filter>
            <meta-data
                android:name="android.view.im"
                android:resource="@xml/method"/>
        </service>

    </application>
</manifest>
Ricardo A.
  • 685
  • 2
  • 8
  • 35