To open the Wi-Fi settings, one can use the following command:

 # am start -n com.android.settings/.Settings\$AdvancedWifiSettingsActivity

Is there a similar command to open the Ethernet settings as following? enter image description here

  • 1
    @AaronGillion I added a screenshot per your request. – Hong Apr 16 '16 at 2:46
  • Woah, that's awesome. What device is this?? – Aaron Gillion Apr 16 '16 at 2:48
  • @AaronGillion It is just a generic tablet. At least many tablets support Ethernet. One could plug in a USB-to-Ethernet adapter to enable Ethernet. – Hong Apr 16 '16 at 2:52
  • 1
    @Hong Since you're asking, I assume that am start -n com.android.settings/.Settings\$EthernetSettingsActivity does not work, correct? – Grimoire Apr 16 '16 at 12:03
  • 1
    @Hong I included the method I used in the answer below. Since its output is far from being refined, you may wish to perform further research and improve my answer with your findings. – Grimoire Apr 16 '16 at 18:50

The way to launch the Ethernet Activity of the Settings, is to issue:

am start -n com.android.settings/.Settings\$EthernetSettingsActivity

in a terminal.

By the way, the method to obtain an unrefined list of all the activities in an app, is to extract such data directly from the AndroidManifest.xml. Luckily, we can accomplish this with the following terminal commands:

path=$(pm path com.android.settings)
aapt d xmltree $path AndroidManifest.xml | grep Settings\$. > /sdcard/SettingsActivities.txt

Now, the first line assigns to the variable path the path where to find the Settings apk. This is useful if you need to include this snippet in a script, and you want to make it portable for various Android flavors.

Line 2 sanitizes the path variable, by removing the "package:" prefix set by pm path, thus making it usable for the third line.

Line 3 does the real job: it dumps the AndroidManifest.xml of the app indicated in the path variable. It also filters the output, in order to consider only the lines which contain "Settings$", and then outputs the result, saving it to a file with an arbitrary name (here SettingsActivities.txt), for further examination.

| improve this answer | |
  • Thanks a lot for the extraordinary elucidation! I tried those commands, but got /system/bin/sh: aapt: not found. – Hong Apr 16 '16 at 19:39
  • Yeah, your device may be one of those that doesn't ship aapt by default. You'll be able to address this issue by downloading the first aapt from izzysoft.de/ftp/local/android , unpack it, and install it on the System partition by following the info provided in the readme.md file (by the way, that site belongs to Izzy, famed Android SE moderator). – Grimoire Apr 16 '16 at 19:50
  • 1
    Thanks a lot! I am all set. Since I may do this for different devices, I pulled settings.apk to my computer and used Android SDK's aapt to extract the information based on your tip. – Hong Apr 16 '16 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.