Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you include ampersands in URLs for adb shell am start?

Tags:

android

adb

Using

$ adb shell am start some://url

I can launch URLs using activity manager. However if I include multiple URL parameters, all but the first parameter gets stripped out.

Example:

$ adb shell am start http://www.example.com?param1=1&param2=2

Returns:

$ Starting: Intent { act=android.intent.action.VIEW dat=http://www.example.com?param1=1 }

and param2 disappears as anything after an ampersand gets ignored. I'm wondering if there's some encoding/escape character for the & that will prevent this.

like image 637
Andy McSherry Avatar asked Nov 28 '12 22:11

Andy McSherry


People also ask

How do I list files in adb shell?

Open cmd type adb shell then press enter. Type ls to view files list. At the DOS prompt, adb shell ls -R > junk lists all files and puts results into file junk which you can then edit via Notepad or whatever and see more than you'd want to, but your files, too!

How do I use commands in ADB?

If multiple devices are running, you must specify the target device when you issue the adb command. To specify the target, use the devices command to get the serial number of the target. Once you have the serial number, use the -s option with the adb commands to specify the serial number.

How do I use remote adb shell?

To connect to your remote Android device, type in the IP address of the device and the port number (5555 from the example above) in Remote ADB Shell. Tap Connect and it will attempt to connect to the device and start up the terminal.


2 Answers

use escape character \:

$ adb shell am start "http://www.example.com?param1=1\&param2=2"
like image 125
Ofir Luzon Avatar answered Oct 04 '22 18:10

Ofir Luzon


The following format seems to work. Note the quotes format ' ":

$ adb shell am start -d '"http://www.example.com?param1=1&param2=2"'

like image 40
Kuba Spatny Avatar answered Oct 04 '22 18:10

Kuba Spatny