The `InputMethodManager` is a service that apps can use to interact with the system keyboards. Editors like `EditText` also use it to indirectly notify the keyboards of changes (for example, [`updateSelection`](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#updateSelection(android.view.View,%20int,%20int,%20int,%20int))).

I can get a reference to the `InputMethodManager` like this

```
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

```

My problem is that this seems to be just for system keyboards. Can I use the `InputMethodManager` for a [custom in-app keyboard](https://stackoverflow.com/a/45005691/3681880)? If it was for just one isolated app I wouldn't care but I am including a custom keyboard in a library that will be used in many apps. I need a standard way for editors to communicate with the keyboard.

Do I have to write my own input method manager or is there a way to use the standard `InputMethodManager` with my custom in-app keyboard?

**Update**

Here are some clues for how I might implement my own custom input method manager if there is no way to use the standard one.

* `InputMethodManager` ([documentation](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html)) ([source code](https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/inputmethod/InputMethodManager.java))
* [`InputMethod` interface](https://developer.android.com/reference/android/view/inputmethod/InputMethod.html)
* [`InputMethodSession` interface](https://developer.android.com/reference/android/view/inputmethod/InputMethodSession.html)
* [`KeyboardView.OnKeyboardActionListener` interface](https://developer.android.com/reference/android/inputmethodservice/KeyboardView.OnKeyboardActionListener.html) (keyboards implement it)
* `InputMethodService` (keyboards extend this) ([documentation](https://developer.android.com/reference/android/inputmethodservice/InputMethodService.html)) ([source code](https://android.googlesource.com/platform/frameworks/base/+/fb13abd800cd610c7f46815848545feff83e5748/core/java/android/inputmethodservice/InputMethodService.java))