How open (switch, set) softkeyboard from my service?
My application is not consist any activity. But i try open softkeyboard on trigger in my service, when alient application is onscreen.
I find in InputMethodManager‘s method setInputMethod. Second argument is id of keyboard. I know it. But first argument is IBinder. What is IBinder argument in my application?
Add detail:
My application consist of Service and InputMethodService.
In Service – Analyzing starting application in system. In InputMethodService – my softkeyboard (IME). If in my Service i determine what is start right application (I dont own this application), I need to switch current softkeyboard to my InputMethodService’s IME. Only switch, but not open keyboard. And when user tap on editabled view in client application, system open my soft keyboard.
My solution code in
Service:p.s. This work only if my application is a system (
nullin first argument insetInputMethodavailable only when my application is system).I programmatically get system privilegies for my app with
mv /data/app/myapp.apk /system/app/myapp.apk(basis on https://stackoverflow.com/a/14257161/1665964).