Questions tagged [scripts]

Scripts are small programs written for a command interpreter or another scripting language.

Filter by
Sorted by
Tagged with
1
vote
1answer
15 views

How to run an Android init service with superuser SELinux context?

I want to run an Android init service. I have a device which has rooted shell (purchased from manufacture as rooted). This device doesn't have Magisk or other su manager but adb shell is rooted and it ...
2
votes
1answer
111 views

How to run an executable on boot and keep it running?

I have an executable build from a ndk-build program. I want to run it on a rooted Android device. How much is the possibility that Android will kill my executable? Using adb shell, I am able to ...
0
votes
0answers
117 views

How to create Android sepolicy based on the denial “execute_no_trans”?

I am trying to execute my script /vendor/bin/init.inmod.sh using below method: Script init.inmod.sh: #!/shebang??? /vendor/bin/test_disp hdcp disable In vendor specific .rc file: on ??? start ...
2
votes
1answer
37 views

find: multiple “-exec” for list of files not working?

I am trying to figure this out on an Android phone running Oreo / 8.0, with toybox 0.7.3-android. I am trying to get a list of files inside a folder and their respective mtime. I am running this ...
0
votes
0answers
23 views

physical keyboard use japanese script on android

I have a Logitec k480 connected by bluetooth to an LG Stylo 4 with Japanese and Spanish added so I can switch between them. My problem is that I can switch between languages but the Japanese layout ...
0
votes
1answer
40 views

using printenv in script sh in recovery TWRP return error execv failed : Exec format error

for example just try this script #!/sbin/sh printenv | grep sdcard >> /tmp/tong.txt in recovery.log i've run_program: execv failed: Exec format error run_program: child exited with status 1 ...
0
votes
0answers
25 views

How can i get the path to the external and internal card in recovery TWRP using sh file

From TWRP recovery I am looking for how to find the path to the external card and internal memory using a sh script. My question is how to get path from internal and external memory and put it in a ...
2
votes
1answer
104 views

how to display text on TWRP recovery screen using a sh file?

I'm trying to display message on TWRP 3.2.3-0 recovery screen using a .sh file. i was thinking using echo command to make that. my update-script is like this ifelse(is_mounted("/system"), unmount("/...
1
vote
2answers
131 views

How would I automate repetitive tasks in Android?

There are many tasks I do repetitively, like connect a Bluetooth headset or connect to a hotspot. How do I typically "code" this? How do I execute? Is there a consistent library or package manager, ...
2
votes
1answer
229 views

Why Package Manger (pm) gives error “java.lang.IllegalArgumentException: Unknown permission:” in shell script?

I created a .sh script which sets app permissions on android devices. If I push the script on /sdcard and run it through adb shell with command sh ./test.sh. The following error occurs on each ...
0
votes
0answers
28 views

How to press & long press the “back” key with a terminal command?

We manage Zebra Mobile computing units running on Android 6.0 Marshmallow through an MDM. For some reason, the MDM interface doesn't show the Android buttons at the bottom of the screen (back, home, ...
1
vote
1answer
89 views

How to enable/disable lock screen from shell script when a special wifi SSID is present?

My Java skills are low, but I'm mastering shell. Is use LineageOS 14.1 (forked from cyanogenmod). I would like to create a shell script on a rooted devive to enable/disable lockscreen (PIN). I ...
0
votes
1answer
20 views

Listening to in-app triggers [closed]

How can we listen for and record in-app events? I've been searching the net for some time without the slightest hint. Bellow are my case specific details for clarity, (though maybe I should be ashamed)...
-1
votes
1answer
56 views

Android 4.2 - how execute shell command on system boot? [duplicate]

How do I do that? I have root access and the it's a custom build of AOSP project.
0
votes
0answers
175 views

Permission Denied on injected /sbin Scripts

I have an android device.. and Honor View 10... L04 version (US). I have a set of tweaks I am injecting into my kernels ramdisk, that all fire off without issue when I adb shell in and manually run ...
0
votes
1answer
50 views

Record setting changes as script?

I am looking for a way to record the setting changes I do manually, in order to be able to repeat them later by running the same script. I tried the MacroDroid app, but it doesn't look it has a "...
0
votes
0answers
33 views

Writing a script to execute user input

I want the script to open an app, log me into it as XYZ, let me do my stuff, then log me out and go to Settings--> Apps--> MyApp to delete data. It would be great if there was a program that would ...
1
vote
0answers
118 views

How to set CPU frequency as early as possible?

What I mean by this question is the sequence of execution of scripts at boot time. Suppose I have this line of script: echo 307000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq I want ...
1
vote
1answer
324 views

How to Check if Script is run once device is booted?

I have a script I need to run once, and only once the phone is booted. I have attempted init.qcom.post_boot.sh, init.sec.boot.sh, debuggerd, and finally mkshrc While my script ran with debuggerd, I ...
2
votes
1answer
107 views

Scripting app that can listen on notifications [closed]

I'm looking for an app that can run in the background, and listen for a silent notification from a different app (i.e. shows up on notification list but makes no sound) and once it appears, make a ...
0
votes
1answer
1k views

Android TV autostart script

I want to run a script after booting from a Android TV box (Xiaomi Mi Box) I tried a lot but nothing works. Is there any option to 'activate' an init.d folder?
0
votes
1answer
65 views

Staging of several android devices made simple

I have to stage several android dongles to comply to my company’s need. I need to setup the WiFi, google account, download 3/4 apps, configure them, change background picture... i’v been Trying to ...
1
vote
3answers
860 views

Script to pull from directory containing spaces

I'm trying to pull Whatsup images from my android phone via ADB using the following script: HOST_DIR=/myImageDirectory DEVICE_DIR="/sdcard/WhatsApp/Media/WhatsApp\ Images" echo started for file in $(....
1
vote
0answers
28 views

Script to disable email signatures in default Android email app

We use Airwatch to manage our company phones, and the task was handed to me to make sure the "Sent from..." default was disabled. Is it possible to create a script that could be pushed out to turn ...
0
votes
0answers
176 views

mkdir based on arguments then copy files to that directory

I'm trying to create a simple script that I can run through the Android adb shell to move two specific files to a directory that is named based on the argument provided but haven't been having any ...
0
votes
3answers
4k views

How can I run a custom .sh script at each startup (without native init.d support)?

This looks like a general concern of rookie Android system players who have just rooted their phones. The most prevalent method may be throwing your script into /system/etc/init.d. If the ROM supports ...
0
votes
0answers
412 views

Automate Android with script/code

I was wondering if there was a way to automate/trigger different settings the way apps like Tasker and IFTTT do directly by coding. I had in mind somethin like a script that would run on the ...
1
vote
1answer
3k views

How to detect GPS status through adb shell?

I need to detect GPS status through adb shell. I have tried dumpsys location command but the output of this command is not changed when the GPS is enabled/disabled.
0
votes
2answers
33k views

Android Emulator - INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113

When I try to install an apk file through the monkeyrunner Python script, getting the error INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113. How can I resolve this issue? ...
0
votes
0answers
86 views

Why sush tries to execute strings in my array as commands and how to prevent that?

When running a script that contains an array in a variable, the strings in the variable will be executed as a command, I don't need anything inside the array to be executed as a command, how to ...
1
vote
2answers
4k views

TWRP recovery: “pm install /path/to.apk” not working

I'm making a flashable zip for TWRP, to debloat my phone. I also want to install apps in the same script. However, when I do "pm install /path/to.apk" (whether in a script or through the terminal) I ...
1
vote
1answer
199 views

Termux/node.js steam hourboost on android

i'm newbie in scripting i'm trying to run node.js script with termux on android and i'm getting errors everytime i have no idea how to fix i know nothing about that so what code must i use? http://...
1
vote
0answers
1k views

LineageOS: run custom script (start service) at boot

Seems like a simple thing. How can I run custom script on my (rooted) android with LineageOS at boot? Neither creating it as /data/local/userinit.d/99sshd nor /data/local/userinit.sh did not help. ...
1
vote
1answer
960 views

How to create a service without any /system/etc/init.d directory

I would to get a boot daemon service. My android 6 device is rooted and I installed busybox pack on it. After remount my /system partition in read/write, I make /system/etc/init.d directory and I ...
1
vote
0answers
147 views

TWRP - Redirect script stdout to recovery output

I have a flashable zip that runs a .sh script on flashing it via TWRP. What it does not do is that it doesn't print stdout of the script to the recovery output (although it logs it in /cache/...
2
votes
1answer
6k views

Tasker to run scripts in terminal shell

I have searched for this but till now I have not found any tasker that would be able to do this, so I decided to ask here. Till now I have been using Trigger Pro as my favorite tasker but it lacks in ...
1
vote
1answer
931 views

execute ussd from shell-script

Every month I need to execute USSD-command. I want to automatize it. My idea is to write shell-script for SManager. I found two ways to make a call (tested from adb): service call phone 2 s16 '*100#' ...
3
votes
0answers
383 views

How to run a script on USB OTG Drive?

First up - I do not have any experience at all with programming in Android or Linux environments. So, very sorry if this question sounds stupid. Here is what I am looking for: I use a USB drive in my ...
1
vote
1answer
8k views

Show a piece of a Google Spreadsheet document on Andriod main screen

I have a Google Spreadsheets document that is frequently updated and there are some cells in it that show a kind of short summary. Let it be a 2x2 block of cells that contains two headers and two ...
0
votes
1answer
528 views

Can I make a flashable zip executing commands?

I'm using cm13 on my OnePlus 3, along with systemless SuperSu and suhide. When I update cm (often), I need to flash both SuperSu and suhide. The problem is that cm comes with root access and when ...
2
votes
0answers
940 views

Batch script use sqlite3 to edit settings.db

I want to create batch script to enable hidden languages in a Huawei phone. But every time I stuck can you guys spot where is my problem @echo off color e cd "%~dp0" mode con:cols=90 lines=40 adb ...
0
votes
1answer
283 views

Clicking a checkbox to an app using a script

I need to automate accepting a terms & conditions on a 3rd party app installed on the Android device. I just need to click a checkbox on that app's T&C UI. Can someone please guide me how I ...
1
vote
1answer
153 views

Renaming text files based on a keyword inside the files

I have many files inside a folder with .txt extension. Now they are named randomly by an app but I want to rename each text file to some words written in those files itself after words Name: but ...
1
vote
1answer
5k views

Reason for chroot failure: tmp-mksh: chroot: not found

Introduction: I formatted a SDCard in ext4 and copied an ArchVersion on it to run it from Android like in this guide (step 6). Of course my device is rooted and am running the following scripts and ...
1
vote
0answers
607 views

Is it possible to have the system/kernel reverse x-axis touch input?

I have a galaxy S6 G920F. I have this problem with my touchscreen. The x-axis input is reversed. When I touch it on the left part it registers the touch on the right etc.. Is there a way to just ...
0
votes
0answers
100 views

CWM recovery Nandroid Backup

Is there any way to create a Nandroid backup inside CWM recovery, by using the /cache/recovery/extendedcommand file? (This file supports all the commands a normal updater-script file supports inside ...
-1
votes
2answers
1k views

Executing script on device shutdown

For custom scripts at boot, we have init.d. I want to know if there's a possibility of executing a custom script when shutting down, something similar to init.d or by using an APK?
2
votes
1answer
1k views

How do i root Android x86_64?

I installed android x86_64 and now I want to root it but all the root scripts are for 32-bit versions of Android. I am using console os lollipop that is not rooted. What are my options? Thanks
1
vote
1answer
2k views

How can a shell script get the number of an incoming/outgoing call?

new user here from Montréal, Canada! So i have a shell script that runs when a call comes in, and another one that runs when i make a call. How can this script get the phone number of the caller / of ...
-1
votes
2answers
134 views

Executing a script

I'm new to Android and trying to find the simplest way to run a 2 line script that deletes files from a specific directory. I Googled the topic and created a file that I called test.sh which has 2 ...