Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:15:49+00:00 2026-06-13T19:15:49+00:00

I am trying to do some auto testing and I need to trigger a

  • 0

I am trying to do some auto testing and I need to trigger a long press of a key using adb command from my PC. For example, a long press home button would bring up the lates used apps.
I found that key event #3 is for home key. But I could not figure out how to trigger a long press of the home button. Some post here suggest using sleep command. But it does not work for me, it always trigger the single click event and then go to sleep. It is not doing a long press action. Please help.

What I tried is:
adb shell input keyevent 3
adb shell sleep 2

I am just using home key as an example. It can be any key on an Android device, for example, the dpad key. back key, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:15:50+00:00Added an answer on June 13, 2026 at 7:15 pm

    sleep did not work for you because the input keyevent command sends both key down and key up event before it completes. To properly emulate the “long” press with sleep you need to send separate event for down and up and use sleep in between. There are plenty of answered questions about sendevent usage here on SO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an auto testing framework using Selenium. I am trying to test our
I'm trying to pass some POST variables from hidden inputs (using JQuery to change
Im trying to get some auto complete to work. I have this URL i
i am trying to apply some condition for an Auto generated textfield, the script
I am trying to implement some code on my web page to auto-scroll after
I am trying some way to optimize following sql statement: exe_sql DELETE FROM tblEvent_type
I'm trying to debug some auto-generated code, but I am a mySQL noob. Everything
I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
I'm trying to generate some additional code base on the auto-generated webservice proxies in
Currently I'm trying to make some sort of vertical auto-scrolling. This is my code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.