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

adb, android

Solution

use escape character `\`:

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

Problem

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.

Original source