Recording Touchscreen Interactions in Android outside Application - java

Is it possible to create a service that collect touch screen interaction data? I have seen that this could be possible in earlier versions of Android but seems to be much more difficult to achieve now. I have found many questions on Stack Overflow that already attempt this solution but don't offer a solution. The problem is also outlined here.
I wish to record the x and y coordinates of each tap and swipe interaction for medical analytics of different user groups. This includes recording scrolling data in (for example) the web browser. So far I can't get it to do this outside of the default application. How can I build a service for this?
I have tried adapting the code here, but nothing seems to work outside the application when other applications are running.

Related

Single application custom Android ROM

I find this question a couple places on the web, but never with a good answer. Let me be specific in the questions asked.
I want to build a custom Android ROM which only features one app. This app is not to interact with any hardware (per now). This app will be launched on the start up of the device. No locked-screen. The device will have to restart if the app malfunctions.
A resource told me that you can change the launcher app of the ROM.
-> Does this mean that the home screen, the one which displays all apps on our phones, is merely another app? If so, can you simply change the launcher app as it is stated here? What were to happen if this app fails?
If this is the case, it would solve the entire issue.
If not, how do you go about making this sort of project? It includes
Making an app on AOSP
Refuse users to leave the app or interact with anything else
Making this app part of the boot-up process
Remove locked screen
Make the app a dependency of the OS (to force shutdown if malfunction)
Thanks in advance for any replies
I just found Android have a topic about dedicated devices (formerly called corporate-owned single-use, or COSU) are a subset of company-owned devices that serve a specific purpose. maybe that can meet your requirement.
BTW, After into the sub-topic lock task mode that mentions about set DPC whitelist APPs and the device policy controller (DPC) needs setup by other steps.... FYR~

how to apply pattern lock on my all apps of my device?

i designed a pattern view using this library
'''implementation 'com.andrognito.patternlockview:patternlockview:1.0.0''''
but how to apply pattern lock on all apps on my android device? how to show my pattern app screen when pattern apply on any app in android device? Thanks in advance.
As I already wrote in my comment. what you want to do is not possible. You can modify the behavior of your own application, but not the one of others.
The main reason is security issues. Imagine you have an app that mimics a log-in screen from BankXY, and displays this screen right before your actual BankXY app log-in screen is displayed. This is called phishing, and is one of the most popular attacking scenarios out there. What you would like to implement would not be a security risk, but the tools to make it possible certainly are.
EDIT:
This was possible before Android 8.0, where the ability of using Services for background executions was significantly limited. It was possible to create a Service that would check the package names of running applications and in case this name is on a black-list, request a pin code for example (See this Question). However, you cannot run background Services for an infinite amount of time anymore.

Android simulate touch on other program

As u know, there are many solutions and codes on stackoverflow for simulating touch on your own app you are developing.
So my question is that i wanna touch a view on other application with my own application.
How can we do this?
Just imagine i wanna click on X,Y position of the screen each X seconds.
Generally speaking, you can't.
You are welcome to write an AccessibilityService. However, this has only limited ability to manipulate other apps, and it requires users to not only install your app but agree to allow your app to have wide access to all their existing app's UIs.

Android - library/app communication

I've worked with Android in the past, but haven't done anything super-advanced or what I'm about to describe so need some guidelines as to what the best approach/method is to do this before I proceed.
I'm not entirely sure how to google this, so it's best to explain.
I want to build an Android library project preferably with the source undisclosed. I read this can be done as follows: Create another jar that the Android library project references. However, not sure if all of the source code can be private. If anyone can point me somewhere, that would be great.
Asides from that, the library needs to expose an API for any Android app to use, and some sort of event mechanism to broadcast an event when certain events happen (e.g when the app is in foreground etc).
A scenario would be:
1) User loads the app which has the library embedded
2) The embedded library detects that the app has loaded and 'sends an event' to the app
3) The app captures the event and does some stuff specific to the app + an API call to the library
I guess what I'm interested mostly is figuring out what the best ways are to capture the callbacks by the app, once the library has sent some event to the app and to reduce the burden on the developer having to spend too much time implementing what needs to be done when certain events are captured.
Hope this makes sense.

Custom Lock Screen Implementation Techniques

So, I have been exploring many similar questions across website (this, this and this and many more). People wanting to implement their own custom lock screen (not talking about widgets). So far there have been two implementation techniques which users are using.
Home Screen Replacement. In this technique its suggested to create a home screen application, where after unlock logic the default screen shows up. I believe that in this situation developer has to disable Home, Search, Menu and Back button when the lock screen is visible and to implement the Screen off-on logic.
An application. In this technique a normal app is made where after unlock logic the default screen shows up. I believe that in this situation developer has to disable Home, Search, Menu and Back button when the lock screen is visible and to implement the Screen off-on logic.
Now, I don't understand that what is the difference between two approaches? StackOverflow community seems to stress more on the home screen replacement technique. I am very new to Android development so I might be missing some aspect about it. Please suggest that which approach should I use and why? (also, which is easy?).
Thanks so much!
I would use the first method, but only for usability reasons. Because it gives the user a choice to easily revert back to the original homescreen/lockscreen if he chooses not to make the new one a default choice yet.
I'm afraid both strategies you described are quite difficult (depending on the api level range you want it to work on). The difficulty is not in their difference, the difficulty is in overriding the buttons (as Google makes it more difficult by closing down security loopholes for the newer api levels).
PS: Please note that Jellybean has a new Daydream functionality. If customizing the lockscreen is all you need. That may be the way to go since Jellybean is much more secure in that respect and more difficult to work with than the previous api levels otherwise.
Also, consider using the HTC screenlock api for HTC devices. This way, your solution won't be too hacky at least for their newer devices. And perhaps, do a version for rooted devices as well, since that too should be easy, for users who already have obtained root on their device. Don't discount the rooted market, users with root access do spend a disproportionate amount of money on applications in Google Play. That much is obvious if you just take a look at some of the rough numbers of downloads for paid applications that say (for root only) that Google Play gives you.

Categories