trigger when keyboard pops up

Post your questions and help other users.

Moderator: Martin

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: trigger when keyboard pops up

Post by Martin » 26 Sep 2016 18:05

Hi,

You can also try to use trigger UI Event to see if it responds in some way when the keyboard is opened.
I don't like to provide an official trigger in Automagic for functions that heavily rely on accessibility services to detect it since it is usually a support nightmare to keep such things working across different Android versions and on different devices (That's also the reason that there's no Google Now integration in Automagic).

Regards,
Martin

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: trigger when keyboard pops up

Post by Martin » 26 Sep 2016 18:16

Trigger UI Event with event Window opened and package name com.google.android.inputmethod.latin seems to work on my device. The package name depends on soft keyboard in use so you might have to search the proper value for your device (see action Init Variable System Setting, category Secure and name default_input_method, it should be the part of the value before the slash).

Regards,
Martin

LED
Posts: 45
Joined: 28 Jun 2014 00:51

Re: trigger when keyboard pops up

Post by LED » 26 Sep 2016 19:45

Thanks a lot but that was a no go to me. I'm on lollipop 5.1.1. zte axon mini.

Does it work on your leaving the "contain text" empty?

Cheers

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: trigger when keyboard pops up

Post by Martin » 27 Sep 2016 19:22

Yes, it works when "contains text" is empty.
The same settings also don't work on a Samsung with Android 6...

akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Re: trigger when keyboard pops up

Post by akhileshg1988 » 18 Apr 2017 05:13

Martin wrote:To my knowledge there's no good way to detect when the keyboard becomes visible. You could try to see if trigger UI Event works.
When using the google keyboard, following settings could work:
Event type: Window opened
Package Name: com.google.android.inputmethod.latin
Text contains text: Showing text keyboard

respectively to detect when the keyboard is closed
Text contains text: Keyboard hidden

This method will probably not be very reliable.

Regards,
Martin
Hey Martin
This "Showing text keyboard" and "Keyboard hidden" stuff doesn't seem to work on Android N. Could you suggest what text should be entered in the 'Text contains' field in order to detect the showing up and hiding of the keyboard with regards to Nougat?

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: trigger when keyboard pops up

Post by anuraag » 19 Apr 2017 08:53

Martin wrote:Trigger UI Event with event Window opened and package name com.google.android.inputmethod.latin seems to work on my device. The package name depends on soft keyboard in use so you might have to search the proper value for your device (see action Init Variable System Setting, category Secure and name default_input_method, it should be the part of the value before the slash).

Regards,
Martin
How to perform action qhen window is closed?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: trigger when keyboard pops up

Post by Martin » 19 Apr 2017 19:45

Hi,

You could try to use trigger UI Event to trigger on all Window opened events of all packages (set package name to *). You probably have to use a condition Expression to check some of the provided variables to see if it's the keyboard or any other window, which indicates that the keyboard was closed.

Regards,
Martin

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: trigger when keyboard pops up

Post by anuraag » 24 Apr 2017 01:03

Isn't that will drain battery much as flow will trigger every second?

Can you add somthing like this? I don't want to purchase another app for this.
https://plus.google.com/+JoãoDias/posts/SxZe7Crq5Mr

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: trigger when keyboard pops up

Post by Martin » 26 Apr 2017 19:28

It should not consume that much battery since your device and CPU are active anyway when you are typing stuff.
There already exists an event type Component focused in trigger UI Event which could be used to detect some of the events you are interested in. Detecting focus lost could be more difficult. I'll add it to the todo list to check how this can be done. Maybe you could detect it by checking that variable source_class_name is not android.widget.EditText.

Regards,
Martin

LED
Posts: 45
Joined: 28 Jun 2014 00:51

Re: trigger when keyboard pops up

Post by LED » 24 May 2017 19:51

Martin, just so you know the new trigger hardware keyboard open or type do nothing on my phone. I have exaustivelly tested. nevertheless I really appreciate you haven't forgotten users were asking for this.

Im on android marshmallow 6.0.1 on a zte axon mini model b2016 but with a modified ROM meant for the model b2015 (non force touch). I know zte tweaks their OS and sometimes they interfere with normal features or even break them.

Post Reply