Questions tagged [scripts]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
59 views

Why does Magisk not run my script on boot?

I have Android 10, Samsung a7. I have root by custom firmware + Magisk. I tried to put script in: /data/adb/service.d/myscript /data/adb/post-fs-data.d/myscript /system/etc/init.d/myscript But it ...
0 votes
0 answers
18 views

How to build a script to stop infinite scrolling in any app

How can I build a code/script to stop infinite scrolling (or scrolling at all) in any app I want to, like YouTube Shorts, IG Reels and Tiktok. Script should not break any app from running at all and ...
  • 11
1 vote
0 answers
41 views

The first few scripts at Android boot-up

What are the first scripts executed by the Android boot-up process before it starts running processes that do not have root privileges?
0 votes
0 answers
17 views

How to use system timer to run a task periodically on a rooted Redmi Note 5 Pro with Busybox installed?

My objective is to periodically switch on and switch off my flashlight by modifying the value of brightness file whose location is sys/class/leds/flashlight/brightness. I am accessing the file as a ...
0 votes
1 answer
64 views

How to periodically switch on and switch off flashlight with 1kHz rate on rooted Redmi Note 5 Oro?

My objective is to write a shell script to periodically turn off and on my phone's flashlight (about 1 kHz or 500Hz). My phone is rooted. So I gained superuser shell access (#) These are the files ...
0 votes
0 answers
92 views

Start script to run app

I have a device connected to a TV, I need that when I start the device it automatically opens the player and plays a video. I thought that I could do the same as linux, writing a bash script, it would ...
  • 1
0 votes
1 answer
135 views

How can I run SetupWizardTestActivity on a rooted Nougat from the phone?

I'm trying to run com.google.android.setupwizard/.SetupWizardTestActivity as a solution to the following... Moto C Plus phone suddenly turns off while in pocket. Turned it on. Turns back off. Plugged ...
  • 381
0 votes
0 answers
51 views

Is there an Android (webserver) app, allowing running a limited set of scripts on the device, remotely?

I was wondering, if there is some sort of an app, or a way, to run limited number of scripts or commands on an Android device over the network. My use case is this: the device I have is inaccessible, ...
  • 141
3 votes
1 answer
2k views

How can I install Greasemonkey, Tampermonkey, or similar in Firefox Android?

I have Firefox 94.1.2 on a Pixel 3XL with Android 10. I'm trying to install a user-script extension like Greasemonkey Tampermonkey. addons.mozilla.org shows these are both available for Android: ...
  • 393
0 votes
0 answers
91 views

Bulk and auto install apps + phone configuration

I'm looking for a solution (free or paid) that allows me to e.g. connect an Android phone to a PC, launch a piece of software and wait until the phone is fully configured (settings, wallpaper, ...
1 vote
0 answers
489 views

How to use rclone-mount with Termux:Boot?

I would like to do what is described in this post: How to mount rclone on Android? and then have Termux:Boot automatically mount my rclone remotes at boot time. As per that post, I am using the static ...
  • 607
2 votes
0 answers
30 views

Write a script to extract memos?

Is it possible to run a script on Android that would access the Samsung memo app, take each note in there, copy its content, send it somewhere (e.g. an email or just store in a text file) then delete ...
1 vote
0 answers
176 views

How to automatically set a CPU governor on boot?

There are apps that can accomplish this task (e.g. "Kernel Adiutor" and others), however they in turn require other apps that can grant them root access to begin with, which is a lot of ...
1 vote
0 answers
116 views

Executing Edify script via adb shell

Edify script is a very limited language that is being used in flashable zips (mostly updater-script files); Within Edify script we can execute shell commands (run_program()) but what about the vice ...
  • 455
0 votes
1 answer
185 views

Run a batch file in Android

I have WhatsApp installed, and the notifications from one group that I am admin for are driving me mad. WhatsApp has the facility to "mute" notifications for 8 hours, but I have to do this ...
  • 11
1 vote
0 answers
217 views

Addon.d script on Android 11

Google introduced system_ext partition in Android 11 which can use system resources and can include system modules that: Extend AOSP system modules in the system partition. We recommend upstreaming ...
2 votes
1 answer
110 views

How can I Automate for selected apps to only use cellular data and not Wi-Fi... and vise versa?

I tried doing it myself (On Automate) but it's a bit too advanced. Can I get your help? Also, I think Android overriding data connection when wifi is on might have to be factored in. I could use ...
  • 381
1 vote
0 answers
133 views

How via "a script" to move files (pics and videos from Camera) from phone to SD card?

A user may have a slow SD card. So taking pictures and videos on internal storage solves the problem nicely. It has 100GB. However, it can get big. And the SD card is 256GB. So the user wants to free ...
  • 210
0 votes
0 answers
181 views

Settings get global mobile_data always returns 0

On a rooted mediatek 6580 phone running Android 5.1.1, if data is enabled using svc data enable or even pulling down the notification bar, the command settings get global mobile_data shows an output ...
  • 383
0 votes
0 answers
48 views

how to add a location tracking script on android?

How can I add a custom script that retrieves the current location and also fetches current sim's cellphone number? I want to root my phone and add a script that notifies me of its location and user ...
0 votes
1 answer
617 views

Is there a way to write/ run custom scripts in the background on my phone?

What I have in mind is pretty simple. I want to write a small script for simple file managing, and I would like for it to be run automatically like once a day. I have some coding experience under my ...
2 votes
1 answer
3k views

How to enable "Disable HW overlays" at startup?

Question is simple, is there an easy way to enable developer options on startup from a command line script or 3rd party app? I want to set the flag for 'Disable HW overlays' on startup because it gets ...
1 vote
1 answer
3k views

adb pull says it pulled all of the files from my Android phone into my Windows PC but in reality it didn't

So I am using adb to copy all of my Android files to my Windows PC with this command: adb pull -a /mnt/sdcard C:\backup And when it's done it says all x amount of files have been pulled, I can ...
2 votes
1 answer
1k views

Run script using init.rc doesn't work

I'm trying to run a script that exectues when the device has finished booting. This particular device does not support running scripts from an init.d directory, which is why I am using init.rc. The ...
1 vote
1 answer
242 views

How to long-press in android 4.1.2 and 4.2.2 using ADB?

I discovered that the command below does not execute in android 4.1.2 and 4.2.2 but it executes from android 4.4+. input touchscreen swipe x1 y1 x2 y2 [duration] I am using my old android 4.1.2 and ...
1 vote
0 answers
63 views

Error trying to copy gz userdata file to partition in adb shell

Dealing with limited space I split my userdata image file with this command: dd if=/dev/block/mtd/by-name/userdata | gzip -c | split -b 250m - /mnt/sdcard/userdata.gz. That works fine, but when I ...
1 vote
0 answers
371 views

How can I dump UI hierarchy to a variable in Bash?

I want to dump the output of uiautomator dump to a variable and read it from there. How can I edit the below script so as to achieve that? #!/system/bin/sh while true ; do uiautomator dump sleep 1 ...
2 votes
1 answer
291 views

Android stops/pauses execution of my background script?

Short version: Why is my bash script (running in the background, started via SSHD) not running every ~30 seconds when it should? (NOTE: SSHD and the script are running as root!) I have a script that ...
  • 492
2 votes
1 answer
202 views

SHELL Command works fine as a standalone command, but fails when put into a shell script?

Android 8.1 PIXEL 2 with root access. I have seen this asked here once before but the only solution didn't help me at all. I am going to try and make this as simple as I can for the example. If I ...
0 votes
0 answers
90 views

Command has different output when running in a shell or in script

I'm trying to run a script on the Nox emulator through adb. After connecting to Nox via adb with adb connect localhost:62001 and copying a script into a /data/scripts/script.sh folder, executing it ...
  • 141
3 votes
2 answers
7k views

Where can I run a .sh script on Android without root?

Lately I've been playing around with .sh scripting in Android. At first I used BusyBox and it's integrated scripting utility, though I quickly realised that coding on the phone isn't the best, so I ...
  • 141
2 votes
2 answers
594 views

How to automate sending my current battery percentage to PC over the internet every 5 minutes?

I'm using Android 9 on my device, there are many times when I'm away from my phone and it is charging in a different room or someone else is using it, is there was a way to send over the battery ...
0 votes
1 answer
641 views

[Sony Xperia XZ1]Remapping camera button

Hello {darkness my old friend} I have a Sony Xperia XZ1(G8341) with AOSP GSI What I would kindly like to ask how to map the "dead" camera button to any function Currently the button doesn't work at ...
2 votes
1 answer
7k views

How to run a script in background from adb shell?

I have a problem with USB tethering on my rooted Nougat phone (LineageOS). After some time phone stops USB tethering. To fix that I run the following script like this: adb shell su nohup sh tether.sh ...
  • 168
0 votes
1 answer
160 views

Detail information on running scripts on the recovery screen

I am looking for more detail information regarding the process mentioned here: 1 https://forum.xda-developers.com/showthread.php?t=2058944 2 https://forum.xda-developers.com/showthread.php?t=...
  • 381
0 votes
0 answers
61 views

Clock resetting when battery is removed

Every time I turn off my phone and remove the battery the clock on it gets reset and it causes problem for some apps I was wondering if there is some other way to sort out the problem like is it ...
  • 1,283
4 votes
1 answer
6k 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 ...
5 votes
1 answer
13k 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
0 answers
1k 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 ...
  • 1
1 vote
1 answer
784 views

Adding custom bootup script to Android-x86 Nougat

I've been happy using Android-x86 Nougat on my system. Thanks to everyone who made that work. I'm now trying to make one small change which is that I want to run a custom init script (a shell script) ...
3 votes
1 answer
89 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 ...
  • 190
0 votes
1 answer
83 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 ...
  • 23
2 votes
1 answer
789 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("/...
  • 23
1 vote
2 answers
911 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, ...
  • 571
3 votes
1 answer
916 views

Commands run on terminal but throw errors 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 ...
  • 33
1 vote
0 answers
2k 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
1 answer
445 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
1 answer
25 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
1 answer
224 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
0 answers
429 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 ...
  • 209