I am implementing a custom keyboard following this guide: http://developer.android.com/guide/topics/text/creating-input-method.html
Is there a way that from within my KeyboardService which application (=package id) I am 'connected' to (which application receives the input events that I send)?
Strange, 6 views in a day, thought this topic was more interesting. Well, anyway, I found a solution, here is the code if anyone ever needs it.
From the InputMethodService
its possible to receive a InputBinding
:
private String getCallerPackageId() {
InputBinding binding = getCurrentInputBinding();
return getApplicationContext().getPackageManager().getNameForUid(binding.getUid());
}