poison pawn
poison pawn

Reputation: 57

How to Count Clicks or Screen Touches on an Underlying App from a Foreground App in Android?

I'm working on an Android project where I need to count the number of clicks or screen touches that occur on an underlying application, even when my app is running in the foreground.

Here's the scenario:

  1. My app is running in the foreground.
  2. Another app (e.g., the calculator app) is running in the background, visible beneath my app.
  3. I need to detect and count the number of times the user touches the screen, even if those touches are technically interacting with the underlying app.

I've tried several approaches, including:

I'm looking for a way to achieve this without requiring root access or modifying the underlying app.

Here are my specific questions:

  1. Is it possible to capture touch events that occur on an underlying app from a foreground app in Android?
  2. If so, what are the recommended approaches or techniques to achieve this?
  3. Are there any specific Android APIs or permissions that I should be using?
  4. Is there a way to detect touch events without interfering with the underlying app's functionality?
  5. Why is onTouchEvent method not called?

Any guidance or code examples would be greatly appreciated.

Thanks in advance!

Upvotes: 0

Views: 23

Answers (0)

Related Questions