In order to do some testing I needed to switch access points while my 
Activity was running. Consequently, I was looking for a way to manually 
change wireless access points via the command line. 

In case this might help someone else, here's what I came up with for 
switching between "test" and "tether" access points.

    # as root go to wifi dir
    adb shell
    cd /data/misc/wifi

    # save original file
    mv wpa_supplicant.conf wpa_supplicant.conf.orig


    # "test" access point
    cp wpa_supplicant.conf.orig wpa_supplicant.conf.test
    chown system:wifi wpa_supplicant.conf.test

    # remove all network info other than "test" access point
    vi wpa_supplicant.conf.test


    # "tether" access point
    cp wpa_supplicant.conf.orig wpa_supplicant.conf.tether
    chown system:wifi wpa_supplicant.conf.tether

    # remove all network info other than "tether"
    vi wpa_supplicant.conf.tether


    # create script for test (/sdcard/wifitest)
    rm wpa_supplicant.conf
    ln -s wpa_supplicant.conf.test wpa_supplicant.conf
    svc wifi disable
    svc wifi enable

    # create script for tether (/sdcard/wifitether)
    rm wpa_supplicant.conf
    ln -s wpa_supplicant.conf.tether wpa_supplicant.conf
    svc wifi disable
    svc wifi enable

    # run applicable script
    bash /sdcard/wifitest
    bash /sdcard/wifitether

    # cleanup
    mv wpa_supplicant.conf.orig wpa_supplicant.conf
    rm wpa_supplicant.conf.test
    rm wpa_supplicant.conf.tether


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to