I know it is easy ,if I can use adb .
$ export ADBHOST=192.168.11.14(device's IP)
$ adb kill-server
$ adb start-server
in this status.I can use adb with wireless.so next,
$ adb shell am start -a android.intent.action.VIEW http://www.google.com
in this status. I can see google page in my android device .
I want to do it without adb. I want to develop a app which send a intent to one device via tcp without install any app. How can I do it?
You can't. Android doesn't wirelessly accept Intents from other devices, except via adb. It would be 100% insecure to do so- anyone could send any intent to anyone. It would be spam central. You need an app on both devices.
Related
I am using Android Studio 2020.3.1.
I want to launch a adb shell from within Android Studio.
I have the Terminal tab at the very bottom of the IDE.
But I can only open "Local" terminals.
Any ideas where I can launch a "Remote" adb shell?
Within you local terminal, you can easily start an adb shell with the command adb shell
Locate adb if it's not already in your executable paths environment variable. The location largely dependent on the OS you use and where you install the Android SDK. In general it's in the ${ANDROID_SDK}/platform-tools/ directory.
Execute adb devices. This will list the connected adb capable devices. If you are not running any emulators and you only connect your phone then your phone would show up (if not then you may need to treat some permission steps depending on your operating system). Let's say the ID of your device is XYZ.
Execute adb -s XYZ shell and you'll be in a shell on your device.
I genymotion emulator and my phone connected , I want to run and debug my application over wifi , I found the instruction to do so but I get this error when I enter this code :
adb tcpip 5555
I get this error :
error: more than one device/emulator
How can I make my device as default or something like that to solve this problem ?
You can send commands to a specific device, according to docs:
$ adb devices
List of devices attached
emulator-5554 device
emulator-5555 device
$ adb -s emulator-5555 do_your_command
Also, if only one is emulator or a real device you can just attach -e or -d and send the command to it:
If you have multiple devices available, but only one is an emulator, use the -e option to send commands to the emulator. Likewise, if there are multiple devices but only one hardware device attached, use the -d option to send commands to the hardware device.
Do following thing which will help you,
You getting the message just because you are connected more than one device.
Run commands
adb devices
after the fire above command, you get the list of the device, From the list select your device id which not emulator
and fire following command
adb -s f725aa8b7ce4(deviceId) tcpip 5555
and after this fire
adb connect yourIp 5555
I was struggling with same issue since months, later while testing in postman I got know that "Appium inspector" is the main reason for this issue. As it creates new session Id and interrupt the running framework server.
Hence, adb kill-server adb start-server resolves the issue as it actually kill the session ID created by Appium inspector and starts new server.
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...
we have android + linux m/c, we log in into linux shell and boot the machine in android GUI.
now we have the some script that is running on the same machine through linux shell. In that case when the script hangs we need to restart android machine. but it result into restarting the linux machine too. as they are on same machine. so i need the way to restart the android so it comes out of hang state and control remains on the script that is running through the linux shell.
so is there any adb or linux command that work for me?
Have you tried simply 'reboot' with adb?
adb reboot
Also you can run complete shell scripts (e.g. to reboot your emulator) via adb:
adb shell <command>
The official docs can be found here.
You can reboot the device by sending the following broadcast:
$ adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
adb reboot should not reboot your linux box.
But in any case, you can redirect the command to a specific adb device using adb -s <device_id> command , where
Device ID can be obtained from the command adb devices
command in this case is reboot
I think the only way to do this is to run another machine in parallel and use that machine to issue commands to your android box similar to how you would with a phone. If you have issues with the IP changing you can reserve an ip on your router and have the machine grab that one instead of asking the routers DHCP for one. This way you can ping the machine and figure out if it's done rebooting to continue the script.
When I develop android apps, sometimes I need to use device and sometimes emulator, the problem is when both are connected then if I want to uninstall my app from emulator only I had to disconnect the device. There must be a way so that I can specify from which device to uninstall or install the app. I have tried adb -s option like this
adb -s "emulator-5554" uninstsll com.myPackage.myApp
But it always opens the adb help options. May be the command is not correct. Please help.
adb -e uninstall com.myPackage.myApp
will serve your purpose. FYI, option -e is for emulator.