How to perform tap hold on android? - android

I'm trying to script a tap and hold on an Android device and I haven't worked out how.
I tried playing with the input command options but couldn't find anything relating to holding.
I've also looked at MonkeyRunner and could succesfully get the desired effect from a computer with the Android device connected, but couldn't run monkeyrunner on the device itself, without a computer.
Is there a way to script a tap and hold/tap down only/long tap on an Android device (I'm just using the shell for now) ? If so how ?

There are several ways to inject events. You can use Robotium or Monkeyrunner for testing. Or you can try to inject events directly this way.

Related

Is there any way to skip Android device setup wizard using ADB when device is on Android P?

I want to skip the Android P setup wizard programmatically to reach Home Screen to proceed doing other scripted jobs. Since the ADB already recognizes the device when plugged on first setup wizard page, I was trying to skip initial setup using it. Is there any way to do that using ADB or by other tools, potentially Python?
I think I may have tried this before and I don't believe there is. While the ADB recognizes that there is a device attached, that doesn't mean it can read it. The device would have to be set up completely before it would be able to interact and read/send data to the ADB.

Is it possible to control Android bluetooth device pairing via adb?

I'm looking into automating certain Bluetooth activities via adb.
I have been able to successfully enable and disable Bluetooth using information found here:
android enable disable bluetooth via command line
but need more capabilities and control than just enable/disable.
While looking for solutions I came across this post:
Need ADB command line to start a youtube video using browser
where chrome is controlled via intents/activities.
I've attempted a similar solution with Bluetooth by unpacking (using apktool) the Settings apk and the bluetooth apk, looking at their AndroidManifest.xml files for a list of their intents and activities - then using those intents and activities via adb,
e.g. (running shell as superuser)
am start -n "com.android.settings.bluetooth.RequestPermissionActivity/android.bluetooth.adapter.action.REQUEST_DISCOVERABLE"
Thus far, commands of this nature have either:
1) Failed outright, "unable to resolve intent" or similar issues
2) Led to a ">" prompt wherein I'm expected to give more input (though I'm not sure what I would enter there)
Ultimately, I'm seeking to control BT connections using adb (so as to be able to automate those tasks via scripts in the future).
I am using a Google Pixel 2 (rooted).
If I am on the right track, any guidance or advice would be appreciated.
If I'm going about this completely wrong, feel free to let me know (and hopefully let me know where I should be looking instead).

Connect to RS232 from Android - No permission dialog or shell command

Objective
I'm developing a custom app for internal use on a rooted android mini-pc.
The goal (between others... so...many...others...) is to be able to turn on and off a tv using the serial port embeeded on the tv.
I'm using an FTDI UART RS232 serial usb cable for it.
Status
The application is working right now, using an android library (serial-driver) i can communicate with the tv, but the problem is that the device asks for permissions every install (and sometimes, weirdly, again on the same device), so it needs to be improved.
Issue
Since the device doesn't have mouse or keyboard by default, when this happens someone has to click the buttons, and since the device is normally hidden behind the screen, it can be really annoying.
My two bits
This problem, i feel, can be solved by two methods, but i still haven't been able to make them work.
Since the device is rooted, i might be able to modify an unknown (to me) parameter that allows me to bypass the permission request. For this i have tried to make an intent filter for the usb device, and to rewrite the interface that controlls this behaviour, both without success. Is there a way to make this android version more lenient about permissions?
I use for other reasons SuperSU inside the app, so i can use the full width of the might shell power. Using this i've been trying to send commands manually to the device (/dev/bus/usb/00X/00Y), but this haven't worked. My theory is that it's beacuse of the permissions of the device path, but even doing an unhealthy chmod 777 i cannot have them working.
So, that's my problem right now. I hope someone here can help me.
Additional data
Running: Custom Android 4.4.2 (Cannot be changed)
Needs to be doable solely from within the apk (but it can use shell commands)
We don't have the manufacturer signature to install it as a system app
We can use only one app, so i cannot have another one to move this one to /sys/apps, and i don't know if an app can do that to itself.
using Busybox stty -F /dev/.../ returns "Operation not permitted"

Inject touch events android

I've been playing around with adb and adb shell input <some input> for the last few hours (building funny little batch scripts that can basically controll my phone.
Since I cannot execute these commands on the device itself without a PC with ADB and I don't want to root my phone I have been looking for an alternative on how to automate user input on the device.
I found a great Tutorial here, however it states that I need a system level permission in order to inject input events into other apps.
Again, I don't want to root my phone and I want the app to be compatible with different devices, so I can't sign it with the platform-key.
Beginning to think it was impossible, I remembered an app that could do such a thing. The anti virus app CM Security is capable of starting the chrome browser and clearing the browser data.
I assume this is done with input injection, but I am not sure about it.

Unlock patterns using adb sendevent in Android

After checking some answers:
Is there a way to unlock android phone via adb, if I KNOW the pattern and
Unlock Screen Galaxy Nexus ADB
Im trying to unlock a pattern using adb commands using this script https://github.com/mattwilson1024/android-pattern-unlock/blob/master/unlock.sh (for automation purpose).
Unfortunately the events arent working but I noticed that if I turn on the screen by myself (without using adb shell input keyevent 26) while the script is running, the events work and the pattern unlock.
Could someone explain me why this is happening and if there is another way to unlock patterns? maybe without using events (like I wrote before is for automation purpose, not for a phone that was locked).
Can you please try following capabilities in your code?
We can use capabilities, where we can directly set the unlockType and unlockKey..
unlockType: ['pin', 'password', 'pattern', 'fingerprint']
unlockKey; If you want to draw suppose 'L', then it would be 1478 in key section.
Let me know if this doesn't work.
Appium version - 1.6.4
Reference - https://github.com/appium/appium-android-driver/blob/master/docs/UNLOCK.md
This feature is available in latest appium release.
If you, for some reason, need to use Matt Wilson's script, this is not going to help you, but if your goal is to unlock your phone with a pattern lock via your computer, try Vysor, a Chrome extension that displays your phone's screen (including the lock screen) on your computer, allowing you to enter your lock pattern using the mouse or (if you have a touch display) your finger. For me, it worked fine, as I explain in more detail here.

Categories

Resources