Android Intercepting Events From Other Apps - android

Does anyone knows how to intercept events from other 3rd party Apps, say, games, Maps, etc.
This includes events like motionevents, screen prompts, etc.
We have limited success with capturing touch events via the AccessibilityService, click, longclick, etc. But hitting a blank dealing with motionevents such as gestures or how the users are interacting with the screen.
(we have approval from users to capture such information in a control study)
We believe that if we root the phone (mess with the kernel) we can get such data but this inadvertently void the warranty on the user phone, so is there any other way to obtain such information on the API level?
Many thanks!

In case you are talking about your application gathering information about other applications life time interaction with the user then definitely no.
If this would be possible you could easily write a key logger and steal someones private data.

Related

How to access touch screen information from home screen on Android

I'm working on an application that continuously logs to a file touch screen information (touch x,y coordinates), I'm using a MotionEvent event to access that information.
I want it to continue working even if the app is closed (home button is pressed).
After some research I found a Service component which can perform long-running operations in the background.
The problem is the MotionEvent is attached to a View and when the app is closed it is not triggering an event anymore.
Is there another way of accessing the screen sensors? or something else I can do?
I'd really appreciate any help I can get!
I want it to continue working even if the app is closed (home button is pressed)
That is not generally possible, for privacy and security reasons. Apps cannot spy on touch input destined for other apps.
You are welcome to explore implementing an accessibility service. Please bear in mind that those APIs are designed for helping people with motor control limitations use their device and its apps. As such, using those APIs for other reasons may not be supported by Google.

Android: click or scroll on behalf of user?

Is that possible?
I'm developing a service for disabled people. They can define voice commands and the service can detect the commands and execute them. Like when the user says "scroll down", The service (which is in fact a background process) takes control of screen and scrolls down (regardless of what application is on foreground), or touches a specific position and so forth. I wonder if this is possible in an android device? If not, what about a rooted device? (i.e the service has the root permissions). I know that getting voice input and processing it is possible. My question is about doing actions like touch (Action_Down) or scroll the user interface on behalf of a user.
Note that I don't have access to whatever application is running! In fact my service doesn't know about the application that is running on foreground. It might be a social media app or a messaging app or a game or whatever else! So in fact my service must be capable of defining input events like touch, swipe, scroll etc.
Thanks in advance!
Yes, that is possible.
For example, ListView has two methods for programmatic scroll:
listView.setSelection(id); //For instant scroll
listView.smoothScrollToPosition(id); // For smooth scroll
For an example of how to use voice triggered actions - check this answer out
For an example of how to inject events programmatically - check this link out

Capture what user types in other applications

Hey before today I thought there is no way to capture what user types in other applications based on my searches in stack overflow an other sites but today I saw an application that can offer emojis based on what you type in social applications. How is that possible?
https://play.google.com/store/apps/details?id=co.dango.emoji.gif
I guess they internally use an AccessibilityService.
This kind of service is intended primarily to assist people with disabilities (something like TalkBack for example). When registered, this service receives AccessibilityEvents. These events are fired for example when the user interacts with the device or the displayed content changes. Internally, they contain a tree of AccessibilityNodeInfos which contain detailed information about the view hierarchy displayed on the screen.
Therefore the app can traverse the AccessibilityNodeInfo tree and extract the text that user enters.
You can read more about AccessibilityServices here.
Bottom line: be careful when you install apps that require the accessibility permission, as they may pose a serious security risk.

Android permissions

For start I must say that I´m new to Android.
I´m a Msc Student and for my Msc thesis I've to develop a system that collects all user inputs on the touchscreen, regardless of the applications that are being used, and it must be done in background.
The objective is to use that data to establish a user profile and then apply an algorithm that continuously compare the new inputs with that old ones to grant the legitimate user authentication.
In other words I've to develop a touchlogger, but not for malicious purposes.
My question is: Are the initial permissions, that a user accepts in the installation process, enough to allow my app to collect the touch inputs from other applications, or it will be blocked because of the sandbox?
Note: The system is to be used for a regular person in a regular device, so rooting the device must not be an option.
Thanks for your help.
Best Regards
This is not possible, especially in newer versions of Android.
This is because even though there are system overlays allow you to display things like chat heads over any other app, you cannot capture touch events and pass them down to the app below. So even if you manage to capture the events, you will end up rendering the device useless, as nothing below your layover will work.

Android Global touch event

I'm making a background app A in android, and want to catch the touch event on the screen.
Because the foreground app B (currently running one) is not my app,
I can't use the intent for inter-app communication.
Can I read the touch sensing information like other GPS or Accelerometer sensors, using public API, hooking(?), even in a low-level from the capacitive touch screen, or in any way? (given the user allowed any permission but rooting)
Fortunately, this is not possible, for obvious security and privacy reasons.

Categories

Resources