0

How can I long press a hard key or keyevent for 20 seconds . Below is my code

longPress hardkey for 10 seconds

device. longPress(‘KEYCODE_CALL’ , 10) Please anyone can help me for solving this issue

2 Answers2

0

The 2 accepted forms would be

device.longPress(‘KEY_CALL’, 10)

or

device.longPress(‘CALL’, 10)

and they should send the long press with 10 secs duration.

To be sure it is working check the output of

$ adb shell
sailfish:/ $ getevent
...

to check the event is sent correctly.

If it doesn't work, it might be that your device node is different, so press the key manually and see getevent output

/dev/input/event4: 0001 0072 00000001
/dev/input/event4: 0000 0000 00000000
/dev/input/event4: 0001 0072 00000000
/dev/input/event4: 0000 0000 00000000

and then you can use it in your script, like

device.longPress(‘CALL’, 10, dev='/dev/input/event4')
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
0

The Above code is not working Actually My Application is FM where i can do long SEEK UP action using keyevent "KEYCODE_SEEK_UP" below is my exact code

device.longPress("KEYCODE_SEEK_UP", 10,dev='/dev/input/event1')

only 0.5 sec only longpress is working