Is it possible to send keys without selecting the element? (ruby client)

I would like to understand if it is possible to send keys without specifying an element. If I know the premise that the keyboard is displayed, I would like to enter the keys without knowing the element selected.

Is this functionallity available in appium’s ruby lib? How it would be the implementation for android and iOS?

Thanks!

for android inject adb command:

adb shell input text "insert%syour%stext%shere"

%s means SPACE