allow computer to access files on the phone from the computer - android

I want to access my phone data from the computer and for this I have to allow the computer to do it from the phone.
The problem is that the phone's screen doesn't work, so is there any way to allow the computer to access the phone's data from my computer?
Oh, and if it matters, I'm using ubuntu and android....

You can use adb if the phone has USB debugging turned on. adb is a program that allows you to access a connected android device. just use adb shell to get an interactive shell on the device, or adb shell command to run a command. To push files to the device use adb push, and to pull them from the device use adb pull

Related

Android device adb another device

Does anyone know how to make a device adb another device.
i.e
Device1 I create a folder apks and copy and paste 5 apk files.
then I use micro usb to micro usb to connect to another device.
then from device1 i adb all these 5 apk files to device2
using something like this a guess ?
adb install 1.apk & adb install 2apk & adb install 3.apk & adb install 4.apk & adb install 5.apk
I know this is possible as I know someone who does it. But their won't reveal how it is done. Thank you
AFAIK, connecting two android devices via USB is meaningless.
You can use adb over tcpip (over WiFi) in order to accomplish this.
Here is what you need to do:
Make sure both devices are on the same network. This can be done by connecting them to the same AP, by peering them together using WiFi direct or
by setting one of the devices as a hotspot and connecting the second to it.
Configure device 2 adbd to work over tcpip (this is done from your desktop shell):
adb tcpip <port number>
From device 1 shell run:
adb connect <device 2 ip>:<port number>
adb install 1.apk
adb install 2.apk2
and so forth...

Device recognized in ADB but not in shell

When I use ADB, my phone is recognized. However, once I enter the shell, the phone mysteriously disappears. This is weird especially because the shell lists "root#nozomi", as "nozomi" is the phone's code name.
And because it is not recognized, I can't, for example, push files:
The adb command is available both on your phone and your host/development machine. However, it is not much useful on your phone from the shell.
adb shell opens a unix command shell on your phone. Commands you enter here are executed on your phone.
When you execute adb devices in the adb shell, you ask your phone if it has any other phones connected to it via the android debugging interface. And clearly your phone tells you, that this is not the case.
Same thing holds for adb push you are asking your phone to push a file to another phone via adb. Since none are connected, you get the error message.
Try exiting the adb shell again and execute commands on the host machine instead.

List adb devices on network

I have a few devices enabled for over the air debugging. Is it possible to list the adb devices on the network? Something similar or to the same effect as adb devices but for devices that are enabled for over the air debugging.
If you do these steps exactly and run the adb devices command, the android device should appear under the List of Attached Devices. First open a command window and make sure you are either in the same directory as adb or have adb in your PATH variable. Then execute the following list of commands:
$adb usb
restarting in USB mode
$ adb devices
List of devices attached
######## device
$ adb tcpip 5555
restarting in TCP mode port: 5555
Get the IP address of your android device. (Usually under System settings then Network settings, you can look up how to get the IP address on your specific device). The IP address should look something like 12.34.56.78 (this could vary though). Once you have the IP address continue with the following commands:
$ adb connect 12.34.56.78
connected to 12.34.56.78:5555
Remove the USB cable from the device
$ adb devices
List of devices attached
12.34.56.78:5555 device
Source
That's not possible with the Android SDK, as it would involve a huge network scan without any clue, just blind-pinging port 5555 of every possible address on the network.
But probably you can do it with a network scanner that looks for port 5555 open.

How to set up ADB for remote machine development and local device deployment

My scenario is this: I telework from home and log into my work machine via Windows Remote Desktop. I use Eclipse as my development environment for Android apps on my work computer.
Using ADB, I would like to be able to deploy apps from my work computer to a device on my home network, for scenarios where the emulator doesn't do the app justice.
I found this post, which discuss a very similar scenario, with the exception of deploying to an emulator running on a local PC, instead of deploying to a local device:
http://www.41post.com/5003/programming/android-adb-remote-emulator-access
I'm trying to take the same steps, but figure out how to target a local device on my home WiFi network & tethered to my local home PC, instead of the local emulator.
Right now, I have the remote PC set up to try and connect to my public router IP on port 5585 - but in my router, what IP/port do I forward this to to connect to the local device?
In the example using the emulator, they forward to the local PC address where the emulator is running and port 5555, and adb is not running on the local PC. I have configured my router to forward to my device IP, with the device on WiFi, as well as my local PC IP where the device is tethered.
However in both scenarios, when I try adb connect <routerIP>:5585 on my remote PC, it gives me an error unable to connect to <routerIP>:5585:5585. I get the same response when trying to forward to/listen to other ports. I'm not getting any security errors in the router log, so it appears the port forwarding is working.
Questions:
What local IP/port number should I forward to when configuring port forwarding on my local network to connect to the local device using the remote adb instance?
Should I be targeting the local PC IP that the device is tethered to, or the local device IP?
If I target the local device IP, what port number should I forward to?
Do I need adb running on my local PC?
I had a similar situation. I work on a remote desktop for development but my android device is connected to my local laptop. I wanted to be able to use adb and the android plugin in eclipse on the remote desktop and connect to the device attached to my laptop. After searching on the internet and not finding anything that really helped, I decided to write a port forwarder that would do the trick. You can find it here. I hope it will be helpful to other people as well.
Beginning Android 4.3 you can:
Make adb server listen on all interfaces. You have two options:
Make gListen=1 and recompile adb (I have compiled it on Linux-x64 machine for you and put it here)
Start adb server with -a parameter: adb -a -P 5037 fork-server server&
Use adb on your remote machine with extra parameter, e.g. adb -H <remote_host> shell
Another setup for remote host + local device testing. This will be useful for lots of people working from home on a laptop, connected to their development host machine still in the office. Note that I assume both devhost/laptop are both running Unix, but other OSes will be able to run the commands on the command prompt/shell.
# Kill old adb server.
devhost$ adb kill-server
# Activate adb server on client
laptop$ adb start-server
# Start ssh tunnel. Hide/minimize this window not to close it by accident
laptop$ ssh -XC -R 5037:localhost:5037 <your devhost machine>
# Should work by now with the local device connected to the laptop
devhost$ adb logcat
You can solve the issue by port forwarding.
Download Secure Shell app from the Chrome app store
Connect to your machine (step-by-step setup)
In this connection, disable adb server: adb kill-server
Create a new port forwarding connection (same as a regular connection, but set the SSH Arguments field to: -N -R 5037:localhost:5037)
On your laptop, open up a terminal and enable adb server: adb start-server
Probably there is a simpler solution, providing the device, the local and remote machine belong to the same network.
Let's say your device has a certain IP over the network and let's say you decide to use your preferred PORT: well, you can do the following steps.
On the machine where the device is plugged please run:
adb devices
adb tcpip <PORT>
Example of PORT is 5555.
On the remote machine you need to deactivate 'Discover USB devices', 'Discover network targets' and 'Port forwarding' and then run:
adb connect IP:PORT
*IP is your android device IP(not the first machine IP) which can get from adb shell ip -f inet addr
And you are ready to debug on remote machine.
This is how I made it work from host macOS with emulator to macOS client.
A: One line command
On host of emulator
socat tcp-l:5560 tcp:localhost:5559
On client
adb connect <IP>:5560
B: With a tunnel
on host
host$ adb kill-server
host$ adb -a nodaemon server
on client
client$ adb kill-server
client$ ssh -L 5037:localhost:5037 <host-IP>
open second shell on client
client$ adb kill-server # I observe first it kills client adb
client$ adb kill-server # then it kills server adb, do it maybe once more
client$ adb devices # show devices on server now
Now I see host emulator in Android Studio as well
My situation required using a VM that is on a different network, but that I rmd into (an Azure VM). The VM and my local laptop are both running Windows 10. First, I had to install USB Redirector RDP Edition on my local machine (costs $80, but there might be free alternatives), then install the Google Android USB driver on the VM and the Universal Adb Driver on the VM. I'm now able to load an Android Studio App the project in Android Studio on the VM, connect an Android device on my laptop, and debug the app on the device.

Read android device info from windows

Is it possible to get android device info (e.g. firmware version) from windows, when device is connected with PC by USB cable?
As I understand AT commands are not available. I was trying to use "adb", but I cannot see any usefull options. Maybe there is some text file with device info on the filesystem of the phone, so I could use "adb shell" to read this file?
Regards!
Use for example
adb -e shell getprop ro.build.display.id
to obtain something like
sdk-eng 2.1 ERD79 22607 test-keys
If you have more than one device or emulator, use
adb devices
to identify them and then use -s serialno in adb command line

Categories

Resources