Is it possible to do adb operations from android phone itself, without a computer? - General Questions and Answers

I have seen discussions online such as this:
https://stackoverflow.com/questions/12634280/what-is-a-adb-daemon
If I understand the answers give there correctly, whenever I use an adb command on my computer connected to a smartphone, the reason it does anything is because there is a background process adbd, the adb daemon, running on the smartphone. Everything I see on the computer screen when I issue an adb command is the result returned by the adbd daemon.
a) Is this correct? Is this how adb is supposed to work?
b) If it is correct, is there any way to programmatically enable/disable/re-enable the adbd process? Can I programmatically interact with adbd at all (either through Java or NDK)? Can I use adbd from the android phone itself and perform actions performed using adb, without using a computer?
I am hoping to do this on a non rooted device, but if not, any kind of device will do.

mahaju said:
I have seen discussions online such as this:
https://stackoverflow.com/questions/12634280/what-is-a-adb-daemon
If I understand the answers give there correctly, whenever I use an adb command on my computer connected to a smartphone, the reason it does anything is because there is a background process adbd, the adb daemon, running on the smartphone. Everything I see on the computer screen when I issue an adb command is the result returned by the adbd daemon.
a) Is this correct? Is this how adb is supposed to work?
b) If it is correct, is there any way to programmatically enable/disable/re-enable the adbd process? Can I programmatically interact with adbd at all (either through Java or NDK)? Can I use adbd from the android phone itself and perform actions performed using adb, without using a computer?
I am hoping to do this on a non rooted device, but if not, any kind of device will do.
Click to expand...
Click to collapse
Yes, but it requires having a rooted device and the terminal emulator app. Or you can install TWRP and use the terminal emulator that is built into TWRP.
Sent from my SM-S767VL using Tapatalk

reply to answer
Droidriven said:
Yes, but it requires having a rooted device and the terminal emulator app. Or you can install TWRP and use the terminal emulator that is built into TWRP.
Sent from my SM-S767VL using Tapatalk
Click to expand...
Click to collapse
I have an old rooted samsung phone with android 4.2.2
Is there any sample code on how I can interact with the adbd daemon? In the terminal emulator if I type "adb shell" it says starting daemon but then it says device not found. how would I do some basic stuff (like take a screen shot using "adb shell screencap" for example? Can I interact with it programmatically from java or ndk?

mahaju said:
I have an old rooted samsung phone with android 4.2.2
Is there any sample code on how I can interact with the adbd daemon? In the terminal emulator if I type "adb shell" it says starting daemon but then it says device not found. how would I do some basic stuff (like take a screen shot using "adb shell screencap" for example? Can I interact with it programmatically from java or ndk?
Click to expand...
Click to collapse
When using terminal emulator, it uses the same commands as adb shell(not the standard adb), but you remove "adb shell" from the commands. For example, in terminal emulator, it is:
reboot recovery
Instead of:
adb reboot recovery
Or
adb shell reboot recovery
Also, before running your commands in terminal emulator, you need to use the su command by typing:
su (then press enter, grant the app superuser/root permissions)
Then you can run the rest of your commands.
Sent from my SM-S767VL using Tapatalk

Related

ADB freezes in Ubuntu 9.10 x64

I recently set up Ubuntu Karmic on my laptop's second hard drive, and I finished setting up Eclipse and the Android SDK yesterday. I set up ADB to work directly from the terminal without changing to the SDK Tools directory, and it works... kind of. I can get some ADB commands working, but most others won't. The only things that really work are "adb help" and "adb devices" at the moment. "adb install", "adb push" / "adb pull", and other similar commands seem to register, but then nothing happens after that- the terminal freezes, and inputting keys shows other characters. ]]^A and stuff like that. Can anyone help?
Ubuntu 9.10x64 adb works with sudo
$ sudo adb push...
I usually make sure the first adb command I use is sudo'd so it starts the daemon as root.
adb help - does not send any data to your droid. It's internal
adb device - shows which devices are on the USB bus.
The other adb command need to talk to the devices and depending on how your udev protections, device protections, and your personal group memberships are... it may not work.
sudo works for me always.
Ehud

[Q] LG Thrill 4G new ROM Help

I have a LG Thrill 4G. I rooted the phone using superonelick, root checker says it is rooted. Downloaded ROM Manger and flashed clockworkmod. I cannot click boot into recovery, it just restarts the phone. I have tried to reboot into recovery by pressing 3d button, down volume, and power and it boots me into the android recovery but not clockworkmod, so I can not find anyway in to download the new rom from the zip file. Has had any other people had trouble with this? I have spent over 2 days searching the internet but I cannot find any similar problems, is there anyway to get into the recovery mode to install the new ROM without it just restarting the phone?
LG Thrill 4G ClockworkMod Installation (correct method)
1) You need to have ROOT access at the least (see link below)
It will also be good to have ADB (and hence LG Thrill drivers) installed properly
http://forum.pandaapp.com/thread/2/11/20110919/4e77f603d22632913-1.html
2) Get the recovery image from here and keep it on your PC in a folder accessible by ADB.
OR (if no ADB then) directly put it on your LG Thrill SDCard root
http://forum.xda-developers.com/showthread.php?t=1257588
4) If you have ADB then follow the instructions in the first link above to push the recovery image to your phone.
OR
if no ADB then open Terminal Emulator (install it from Market) and type su and click allow if the prompt comes up
5) Now you can follow instructions in the first link (far above) again, starting from the 'dd if=...' step. But instead of rebooting you could just power off
6) Clockwork recovery should now be flashed. To enter recovery, keep the 3D button, Vol-down and Power button pressed until you see the LG logo
Thank you for getting back with me. I tried to follow these steps and when I am in the Terminal Emulator and type adb push recovery.img /data it comes back with adb: not found. I have redownloaded the recovery file that you have attached to the SD card, same error, and then I tried to copy to the phone itself and same error. I can do any of the other prompts for the emulator but nothing that has to do with the recovery file it will not work. I am guessing maybe this is the problem because if it cannot find the recovery file, I cant do much of anything else. Do you have any suggestions of why the file still cannot be found on my phone?
connect adb through tcp
Try this:
1. If you are using terminal emulator to access adb then try downloading the app called remote adb. This tool will allow you to connect your device via tcp. Take note of the ip adress and port number. Usually the default port is fine.
2. Now open sshdroid, connectbot, terminal emulator and start an ssh session with the adb shell. You must have the correct public ip and port entered in to access the adb via tcp.
3. Once you have made the ssh connection between what ever emulator you are using and remote adb, start a shell as su.
4. Type the commands mentioned earlier.
This should let you run the whole thing from within your phone.
Alternatively...
1. start remote adb on your device.
2. start a terminal or cmd prompt on your cpu.
3. cd to androidSDK\platform-tools
4. type ---> adb start-server
The server then sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585, the range used by emulators/devices. Where the server finds an adb daemon, it sets up a connection to that port.
Note that each emulator/device instance acquires a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb connections. For example:
Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557 ...
As shown, the emulator instance connected to adb on port 5555 is the same as the instance whose console listens on port 5554.
Once the server has set up connections to all emulator instances, you can use adb commands to control and access those instances. Because the server manages connections to emulator/device instances and handles commands from multiple adb clients, you can control any emulator/device instance from any client (or from a script).
5. type --> adb forward tcp:5554 tcp:5555
5. type ---> adb devices. In response, adb prints this status information for your device. If there is no emulator/device running, adb returns no device, and you have not made a tcp connection.
6. Take note of the serial number listed. You will use it later to direct commands to device.
7. Type --> adb shell
8. Type --> su
9. Use commands from other post to achieve whatever you need.
10. once finished with shell, type --> exit twice to leave the shell
11. Finally, type --> adb server-kill
Hope that helps. Seems like you were having issues making the connection from device to adb, so that is what I focused on. If I can help anymore, just ask. We are all continually learning and the only stupid question is the one never asked.
B^)

[S-Off] and Device Offline for PJ831000

This was answered a little bit in the S-Off thread and I would like to post it for everyone that has the PJ8310000 device and they are running into device "offline" when using adb devices. This is for Windows 8 only. I had the same problem in OSX, but I believe the solution is the same. I cannot post in the thread in the developer section yet, that is why this is here.
First, if you can't see your device in your device manager, make sure you have the latest HTC Device drivers installed or install the latest version of HTC Sync. This is very important for Windows 8.
Second, you will need to download and install the latest Android SDK. Just "Download From Other Platforms" and choose the appropriate SDK installation. You will need to run the SDK Manager.exe to install the latest tools. Note: ADB and Fastboot have been moved from the "tools" folder to "platform-tools".
Make sure your phone is in debugging mode by going into the Developer Options and choosing "Android debugging."
Find your SDK installation and make sure you are under "platform-tools" folder. You can ctrl-shift-right click on that folder to open a command prompt at that folder location. Saves you time.
Type in the command prompt:
Code:
adb devices
Your device should be listed and probably says Offline. This is normal. Take a look at your phone, you should get a prompt on your phone asking you if you trust the device that is trying to connect to it (this should be your computer). Allow it.
Type in the command prompt:
Code:
adb devices
This time, your device should be listed with the word "device" instead of offline.
To restart the daemon, type the following separately:
Code:
adb kill-server
adb start-server
This is the best I can do for everyone and it solved my problems with no further issues. I am not an expert and this is the only solution that has worked for me.
Thanks, this worked for me.
I did this in Windows 7 SP1 no problem. All I had to so was get the latest Android SDK and replace all the adb/fastboot files I already had and it worked no problems.
If you get permission denied when doing the last "adb shell" command, get adbd insecure from the forums here and run debugging mode insecurely from there.
Sent from my One X using xda app-developers app
Desertman123 said:
If you get permission denied when doing the last "adb shell" command, get adbd insecure from the forums here and run debugging mode insecurely from there.
Click to expand...
Click to collapse
I had this problem because SU was only allowing apps in CM10.1 (4.2.1). I found the solution by enabling the Dev Options via multiple clicks on the Build number until dev options was enabled, then changed Root access to Apps adn ADB.
FYI for anyone else that gets lost like I was.
ok so i can s-off now?
yes get some, 9 steps to s0ff
Ponarona said:
ok so i can s-off now?
Click to expand...
Click to collapse
Yes, you can use the HTC One XL link in the S-Off thread with no issues. I made this to help people with Win8 and trying to get their phones to appear properly in their device manager and to list it under adb devices.
If you get device offline, my issue, I was running android 4.2.2 but had an outdated adb. Just update adb if you still have problems
I know this is exceedingly random, but if you run a mac and can't see your device in adb, and in the past you tried sharing your phone internet with your mac via usb try running this:
sudo kextunload /System/Library/Extensions/EasyTetherUSBEthernet.kext
./adb kill-server
I need to do that before every adb session.
I'd be amazed someone actually has those conditions, but hey, it might help someone.
Sent from my HTC One X using xda app-developers app

[APP]MTK ADB, Use ADB directly on your device

MTK ADB gets you a privileged shell at the push of a button, allowing you to run commands directly on your MediaTek device. Some might wonder if rooting hasn't already solved this. Firstly, root access is persisted by modifying system files. When the real binary gets substituted by that of the root app's, if the device is rebooted, the init daemon running as root runs the binary giving the app root. What's wrong with this? If you have “purist” tendencies, you probably would want your phone as stock as possible, or at least with your permission. Sadly, not only binaries are dumped. Extra temp files, logs and helper binaries too, that manually removing them is like dancing on floor of pins and a prick means a brick. Not only that, consider yourself blocked from updates. If you're unfortunate enough, an update could result in bricking your phone as the files supposed to be present had been changed. This is more common than you think. MTK ADB makes no changes to your files whatsoever. Also, there's the matter of security/privacy. Root apps tend to always do something in the background. Either sneaking in a new app, or phoning home with your private data, or both. MTK ADB doesn't steal your data. The Internet permission is for Telnet, etc. On some devices, MTK ADB can get root access (depending on manufacturer) while all devices can get shell access. You just have to check which yours belongs.
IMPORTANT
•Refresh before (and after) clicking Start to check ADB status.
•Supports all ADB functionality. Just run "adb <command>" eg "adb pull" (without quotes).
•The minimalist terminal is for those who haven't any. Feel free to use your regular terminal (I use Terminal IDE) and keyboard (Hacker's Keyboard is really good). Just run "adb shell" on it.
•You can connect to your device using another phone, PC, or anything with a terminal and in the same network by running "adb connect IP_address".
•If you get a " device offline" error, disable and enable USB debugging. Next time connect to the network before running the app.
http://www.youtube.com/watch?v=_bt8BVaDCf0
http://slaycode.WordPress.com
Bump
Proof:
http://forum.xda-developers.com/gen...iled-error-t3191150/post62611445#post62611445
More Proof:
http://forum.xda-developers.com/fire-phone/general/root-fire-phone-supersu-t3105546/page10
Proof:
http://forum.xda-developers.com/gen...iled-error-t3191150/post62611445#post62611445
More Proof:
http://forum.xda-developers.com/fire-phone/general/root-fire-phone-supersu-t3105546/page10
When I open the app it opens but it doesn't work when I enter the commands and moreover the app when I try to start the adb it says unsupported device
Am using infinix hot 4 pro running NOUGAT xos 2.2
LordFME said:
MTK ADB gets you a privileged shell at the push of a button, allowing you to run commands directly on your MediaTek device. Some might wonder if rooting hasn't already solved this. Firstly, root access is persisted by modifying system files. When the real binary gets substituted by that of the root app's, if the device is rebooted, the init daemon running as root runs the binary giving the app root. What's wrong with this? If you have “purist” tendencies, you probably would want your phone as stock as possible, or at least with your permission. Sadly, not only binaries are dumped. Extra temp files, logs and helper binaries too, that manually removing them is like dancing on floor of pins and a prick means a brick. Not only that, consider yourself blocked from updates. If you're unfortunate enough, an update could result in bricking your phone as the files supposed to be present had been changed. This is more common than you think. MTK ADB makes no changes to your files whatsoever. Also, there's the matter of security/privacy. Root apps tend to always do something in the background. Either sneaking in a new app, or phoning home with your private data, or both. MTK ADB doesn't steal your data. The Internet permission is for Telnet, etc. On some devices, MTK ADB can get root access (depending on manufacturer) while all devices can get shell access. You just have to check which yours belongs.
IMPORTANT
•Refresh before (and after) clicking Start to check ADB status.
•Supports all ADB functionality. Just run "adb <command>" eg "adb pull" (without quotes).
•The minimalist terminal is for those who haven't any. Feel free to use your regular terminal (I use Terminal IDE) and keyboard (Hacker's Keyboard is really good). Just run "adb shell" on it.
•You can connect to your device using another phone, PC, or anything with a terminal and in the same network by running "adb connect IP_address".
•If you get a " device offline" error, disable and enable USB debugging. Next time connect to the network before running the app.
http://slaycode.WordPress.com
Click to expand...
Click to collapse
Are you familiar with an APK that utilizes mtk_bypass to directly flash firmware to device.
I'm looking for an APK that basically does what sp flash tool does because I don't have a computer.

Android 4.1.1 - Files executed with an ADB connection

Hi.
I'm trying to control the access to ADB on Android 4.1.1. I already have root access to the device and now I'm trying to execute some access control code at the start of an ADB connection.
Are there any scripts that are executed with the "adb shell" access?
Thank you!

Categories

Resources