Questions tagged [scripts]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
29 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 ...
0
votes
0answers
20 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 ...
0
votes
0answers
32 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
1answer
49 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
1answer
672 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
1answer
389 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
1answer
243 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
0answers
70 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 ...
0
votes
0answers
38 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 ...
0
votes
0answers
53 views

Move files from android internal memory to sd card automatically

When I download music to my phone, the app only allows me to download the songs to the internal memory, but I like to store all my music in SD:/Music/ so for now I've just been downloading songs and ...
2
votes
1answer
97 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 ...
1
vote
1answer
33 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
0answers
42 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 ...
3
votes
1answer
2k 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 ...
2
votes
2answers
213 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
1answer
170 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
1answer
3k 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 ...
0
votes
1answer
93 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=...
0
votes
0answers
40 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
vote
1answer
2k 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 ...
3
votes
1answer
6k 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
638 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
vote
1answer
545 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
1answer
64 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
1answer
67 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 ...
2
votes
1answer
526 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
471 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, ...
3
votes
1answer
685 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 ...
0
votes
0answers
374 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
248 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
24 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
140 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
299 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
70 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 "...
1
vote
0answers
304 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
490 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
214 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
2k 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?
1
vote
1answer
88 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
2k 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
31 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
195 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
7k 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
490 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 ...
3
votes
1answer
5k 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
1answer
59k 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
102 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
5k 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
242 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
2k 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. ...