Frage

I am developing Bluetooth keyboard driver for android. I want to enable my keyboard input method automatically and set it, by just click of toggle button. By enabling I mean enter image description here

enter image description here

Now I want to do this programmatically by just one click of toggle button , i want to bypass these steps for the user and provide them a toggle button which is doing these steps.

InputMethodManager m = (InputMethodManager) BluezIMESettings.this.getSystemService(INPUT_METHOD_SERVICE);
m.setInputMethod(token, id);

Now where i can get this token and ID ? , i searched in API description i get this

token Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself.

id The unique identifier for the new input method to be switched to.

Thank you for your help...

War es hilfreich?

Lösung

You cannot set the Input Method programmatically, you have to navigate to the settings so the users can change the settings. Android secured this option so no bloatware takes over the device.

Same story as enabling GPS programmatically, it is not possible!

Also se this question.

Andere Tipps

You CAN set the input method programmatically, but you have to sign your app with a platform key to be able to write secure settings (android.permission.WRITE_SECURE_SETTINGS), which limits your possibilities to your own ports of Android.

The simple answer -- "it is not possible... " -- is in fact incorrect, if you sign your app with a platform key.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top