I need to run a script that sets cpu_freq .In order to retain the settings after reboot i need to run script which takes care of this issue.I tried to write service in init.rc but the edited part in init.rc disappears on reboot .is there some other way to start script on reboot.thanks
I've found success with magisk. When installed, it adds a directory for boot scripts under /data/adb/service.d, in which you can throw your shell scripts and have them executed by Magisk on boot.
For example, I have the following script:
#!/bin/sh
sleep 15 # to make sure we aren't running in an early stage of the boot process
crond -b -c /data/crontab/
Once created as /data/adb/service.d/start-crond.sh and made executable, it automatically launches crond at boot (provided by Magisk's internal busybox instance).
Use Script Manager.
This link may be helpful:
[ADDON][Xperia S] Generic startup/init.d scripts support for Stock ROM/Kernel
http://forum.xda-developers.com/showthread.php?t=1547238
Although it is for Xperia S, it also works for my ideos. I think the theory behind is quite generic. And if you have installed busybox, you can unzip the downloaded package, read the batch and make some change to the phone by yourself.
If you really want to run your script manually after boot, I prefer scriptme in play market. It's simple and small.
Related
I have some test data for my program that i want to push to the device before a test activity is run or debug. On the command line this is:
adb -s RF8M40T69JX push --sync -z any test_data /storage/emulated/0/Download/test_data
I know i can run an external tool shell script with the "Before launch" configuration option. But this does not give me any way to know on which device Studio want to start it. I don't want to waste the time and dispatch to every possible device and every Edit-Compile-Run cycle.
I checked that the device signature is unfortunately not passed as environment variable to external tools as it should be. Is there any other way? Can i do this with some Gradle magic?
I need to start a script in a termux environment on my android tablet from an other android app. I think it should be possible in two ways.
setting up some kind of startup script (like the ~/.bashrc in the bash shell) in termunx and starting termux from the other app
calling termux from the other app with the script name as parameter, so that termux executes that script immediately.
I don't know how to do either of these possibilities.
Does anybody know how to accomplish it, maybe with a third method, I didn't think of so far?
I didn't see the wood for the trees. The answer is exactly my first suggested way. I didn't realize, that bash is the default shell in termux. So just one of .bashrc .profile .bash_profile do the job.
I was wondering if the only way to run an executable in android is by installing an apk. Would it be possible to run an elf executable? Just as done on linux.
Just drop and run it might be a problem due to restrictions that android uses. Note that those restrictions are updated every Android version.
If you target your executable to run on a rooted device, you can write an app that dumps the executable in a way that bypasses the restrictions and runs it.
If you target you executable to run on a custom ROM or Recovery, you can place the executable in a way that pass the restrictions and run it (without the need of a wrapper app).
if the executable is built for the target architecture, then
If the executable is statically linked: Yes
If the executable is built with Android toolchain/NDK: Yes
If you have the libraries against which the executable is linked: Yes
fi
If you have USB debugging enabled, just use adb push to copy the executable to device, not to a location mounted with noexec, and go to the shell with adb shell, and execute it. You might need to chmod it before executing.
I have a program that I would like to install on an android phone (x86). The program can be installed on a Linux PC. The procedure of installing the program on the PC is:
$./configure
$make
$make install
Now I would like to do the above through android ADB so I can install it on the phone. What are the utilities needed? (I cannot find "make" in busybox http://www.busybox.net/live_bbox/live_bbox.html)
Building your program directly on the phone probably isn't going to be practical. The number of dependencies that make will wind up invoking during the build process will be huge, and either not exist or not work well on the device itself.
It would be better to look at cross-compiling, where you use a different system to build a binary that is suitable for your device.
It wouldn't be possible to provide more specific info without more detail, but be warned: you're probably in for a big project.
Maybe start here? http://forum.xda-developers.com/showthread.php?t=2723240
When I want to test an android application, I create a new AVD, start it in the emulator, wait for the emulator to finish booting, and then use ADB to install the application, and when I'm done delete the AVD. Are there any tools that automate all of those steps? I tried writing my own but I couldn't find a way to tell if the emulator was completely booted, as the Android SDK website says not to use "adb wait-for-device install file.apk".
You're right not to use wait-for-device. It does not wait for the package manager to be available, which is what you need. I'm not sure how eclipse does it but you can poll the emulator until the package manager is available using the command adb shell pm path android. The command should return 'package: something'. Check out this python script that uses the technique: www.netmite.com/android/mydroid/1.6/.../adb_interface.py. It's pretty big but if you search for the command above you'll find the relevant piece of the script.
Why do you want to delete the AVD every time?
If you are deleting it every time because the install command throws an error due to the app already existing on the AVD, you can do this: adb install -r file.apk. The -r part is used for reinstalling the app. Here is the full usage instructions for adb.
Are you deleting it to remove the application you are testing and revert to a 'clean' emulator? If so it's not necessary to delete the AVD every time. You can specify the -wipe-data option when starting the emulator. This effectively resets the AVD to how it was when you created it. Here is the emulator documentation.
Hopefully that helps simplify your script.