4

My app sometimes shows a notification to simplify switching to the app's internal input method. Therefore, I am executing

((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).showInputMethodPicker();

when the user clicks the notification.

This has worked so far, but does not always work on Android 9: When my app is in foreground, it works. When it is not, nothing happens. On logcat, I see a warning

"Warning 889 InputMethodManagerService Ignoring showInputMethodPickerFromClient of uid 10210: com.android.internal.view.IInputMethodClient$Stub$Proxy@edf46f0".

Is there any way to make this work again?

Update: I have tried to create an activity, calling showInputMethodPicker(); in onResume(). This works (if I use postDelayed() with a relatively long delay which is unfortunate), but I cannot get the activity to close itself automatically. So this doesn't seem to be a good way.

Philipp
  • 11,549
  • 8
  • 66
  • 126
  • Is there any way to make this work again? - probably not, they tightened restrictions for showing IME to fix a bug - https://android.googlesource.com/platform/frameworks/base/+/eb5706183f62b9230fb1ae9eb22254a062e7869c – Константин Осипов Sep 16 '18 at 15:04

1 Answers1

1

The problem can be solved by setting the WRITE_SECURE_SETTINGS permission for your App.

Unfortunately, this requires issuing one adb command:

adb shell pm grant com.name.app android.permission.WRITE_SECURE_SETTINGS

where com.name.app is the package name of your app.

Marwen Doukh
  • 1,946
  • 17
  • 26
Flnch
  • 11
  • 2