Code to Control Internet Connections - like Togga

by simonc » Fri, 13 Mar 2009 01:42:40 GMT


Sponsored Links
 Hey,
Does anyone have the code for Togga's internet connection create /
destroy?

I'm creating an app that needs to open an internet connection for a
little bit then close it again. My app works if I use Togga to open
the internet connection then I run my App then I use togga to close
the internet connection. But in NZ Mobile data is really really
expensive so I'm wanting to limit the time I'm on the net.

I'm wanting to do it automagically via code.

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Bluetooth not working on G1 device (cupcake version)

Your init.trout.rc is wrong. This is all you need in it for Bluetooth:

service hciattach /system/bin/hciattach \
    -n -s 115200 /dev/ttyHS0 texas 4000000 flow
    user bluetooth
    group bluetooth net_bt_admin
    disabled

Note its ttyHS0 on cupcake, not MSM0. This is because we changed to the High
Speed uart driver.

Hope this helps.

Nick








--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. wpa_supplicant wifi problems no scan results

I have an Atheros 5007EG wireless network card at my hardware
platform. I compiled the kernel(2.6.27) with ath5k built in.

Then I compiled wpa_supplicant with CONFIG_WIRELESS_EXTENSIONS=y
CONFIG_DRIVER_WEXT=y and CONFIG_CTRL_IFACE=y.

Then in my init.rc :
    mkdir /data/misc/wifi 0770 wifi wifi
    mkdir /data/misc/wifi/sockets 0770 wifi wifi
    mkdir /data/system/wpa_supplicant 0770 wifi wifi
    mkdir /data/misc/dhcp 0770 dhcp dhcp
    chown dhcp dhcp /data/misc/dhcp

    ifup wlan0

service wpa_supplicant /system/bin/logwrapper /system/bin/
wpa_supplicant -Dwext -iwlan0 -c/system/etc/wifi/wpa_supplicant.conf -
dd
    group wifi

My wpa_supplicant.conf at /system/etc/wifi/wpa_supplicant.conf :

update_config=1
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=system

Then when I try to scan with: wpa_cli -p/data/system/wpa_supplicant -
iwlan0 and then scan & scan_results, I'm getting no scan results, when
I know there are definitly scan results. Because when I scanned with
Windows, I do get to see scan results.

What is wrong with my configuration?

My logcat output from wpa_supplicant:

I//system/bin/wpa_supplicant( 2127): Initializing interface 'wlan0'
conf '/system/etc/wifi/wpa_supplicant.conf' driver 'wext'
ctrl_interface 'N/A' bridge 'N/A'
I//system/bin/wpa_supplicant( 2127): Configuration file '/system/etc/
wifi/wpa_supplicant.conf' -> '/system/etc/wifi/wpa_supplicant.conf'
I//system/bin/wpa_supplicant( 2127): Reading configuration file '/
system/etc/wifi/wpa_supplicant.conf'
I//system/bin/wpa_supplicant( 2127): update_config=1
I//system/bin/wpa_supplicant( 2127): ctrl_interface='DIR=/data/system/
wpa_supplicant'
I//system/bin/wpa_supplicant( 2127): Initializing interface (2)
'wlan0'
I//system/bin/wpa_supplicant( 2127): EAPOL: SUPP_PAE entering state
DISCONNECTED
I//system/bin/wpa_supplicant( 2127): EAPOL: KEY_RX entering state
NO_KEY_RECEIVE
I//system/bin/wpa_supplicant( 2127): EAPOL: SUPP_BE entering state
INITIALIZE
I//system/bin/wpa_supplicant( 2127): EAP: EAP entering state DISABLED
I//system/bin/wpa_supplicant( 2127): EAPOL: External notification -
portEnabled=0
I//system/bin/wpa_supplicant( 2127): EAPOL: External notification -
portValid=0
I//system/bin/wpa_supplicant( 2127): SIOCGIWRANGE: WE(compiled)=22 WE
(source)=21 enc_capa=0xf
I//system/bin/wpa_supplicant( 2127):   capabilities: key_mgmt 0xf enc
0xf
I//system/bin/wpa_supplicant( 2127): WEXT: Operstate: linkmode=1,
operstate=5
I//system/bin/wpa_supplicant( 2127): Own MAC address:
00:22:43:2c:fa:a6
I//system/bin/wpa_supplicant( 2127): wpa_driver_wext_set_wpa
I//system/bin/wpa_supplicant( 2127): wpa_driver_wext_set_key: alg=0
key_idx=0 set_tx=0 seq_len=0 key_len=0
I//system/bin/wpa_supplicant( 2127): wpa_driver_wext_set_key: alg=0
key_idx=1 set_tx=0 seq_len=0 key_len=0
I//system/bin/wpa_supplicant( 2127): wpa_driver_wext_set_key: alg=0
key_idx=2 set_tx=0 seq_len=0 key_len=0
I//system/bin/wpa_supplicant( 2127): wpa_driver_wext_set_key: alg=0
key_idx=3 set_tx=0 seq_len=0 key_len=0
I//system/bin/wpa_supplicant( 2127):
wpa_driver_wext_set_countermeasures
I//system/bin/wpa_supplicant( 2127): ioctl[SIOCSIWAUTH]: Operation not
supported on transport endpoint
I//system/bin/wpa_supplicant( 2127): WEXT auth param 4 value 0x0 -
wpa_driver_wext_set_drop_unencrypted
I//system/bin/wpa_supplicant( 2127): Setting scan request: 0 sec
100000 usec
I//system/bin/wpa_supplicant( 2127): Using existing control interface
directory.
I//system/bin/wpa_supplicant( 2127): ctrl_iface bind(PF_UNIX) failed:
Address already in use
I//system/bin/wpa_supplicant( 2127): ctrl_iface exists, but does not
allow connections - assuming it was leftover from forced program
termination
I//system/bin/wpa_supplicant( 2127): Successfully replaced leftover
ctrl_iface socket '/data/system/wpa_supplicant/wlan0'
I//system/bin/wpa_supplicant( 2127): Added interface wlan0
I//system/bin/wpa_supplicant( 2127): RTM_NEWLINK: operstate=0
ifi_flags=0x1003 ([UP])
I//system/bin/wpa_supplicant( 2127): RTM_NEWLINK, IFLA_IFNAME:
Interface 'wlan0' added
I//system/bin/wpa_supplicant( 2127): Wireless event: cmd=0x8b06 len=8
I//system/bin/wpa_supplicant( 2127): State: DISCONNECTED -> SCANNING
I//system/bin/wpa_supplicant( 2127): CTRL-EVENT-STATE-CHANGE id=-1
state=2
I//system/bin/wpa_supplicant( 2127): Starting AP scan (broadcast SSID)
I//system/bin/wpa_supplicant( 2127): Trying to get current scan
results first without requesting a new scan to speed up initial
association
I//system/bin/wpa_supplicant( 2127): Received 0 bytes of scan results
(0 BSSes)
I//system/bin/wpa_supplicant( 2127): Scan results: 0
I//system/bin/wpa_supplicant( 2127): CTRL-EVENT-SCAN-RESULTS  Ready
I//system/bin/wpa_supplicant( 2127): No suitable AP found.
I//system/bin/wpa_supplicant( 2127): Setting scan request: 0 sec 0
usec
I//system/bin/wpa_supplicant( 2127): No enabled networks - do not scan
I//system/bin/wpa_supplicant( 2127): State: SCANNING -> INACTIVE
I//system/bin/wpa_supplicant( 2127): CTRL-EVENT-STATE-CHANGE id=-1
state=1
.....
.....
I//system/bin/wpa_supplicant( 2127): RX ctrl_iface - hexdump_ascii
(len=6):
I//system/bin/wpa_supplicant( 2127):      53 54 41 54 55
53                                 STATUS
I//system/bin/wpa_supplicant( 2127): RX ctrl_iface - hexdump_ascii
(len=11):
I//system/bin/wpa_supplicant( 2127):      44 52 49 56 45 52 20 52 53
53 49                  DRIVER RSSI
I//system/bin/wpa_supplicant( 2127): RX ctrl_iface - hexdump_ascii
(len=16):
I//system/bin/wpa_supplicant( 2127):      44 52 49 56 45 52 20 4c 49
4e 4b 53 50 45 45 44   DRIVER LINKSPEED
I//system/bin/wpa_supplicant( 2127): RX ctrl_iface - hexdump_ascii
(len=14):
I//system/bin/wpa_supplicant( 2127):      44 52 49 56 45 52 20 4d 41
43 41 44 44 52         DRIVER MACADDR
V/WifiStateTracker( 2137): Connection to supplicant established,
state=INACTIVE
I//system/bin/wpa_supplicant( 2127): RX ctrl_iface - hexdump_ascii
(len=21):
I//system/bin/wpa_supplicant( 2127):      44 52 49 56 45 52 20 52 58
46 49 4c 54 45 52 2d   DRIVER RXFILTER-
I//system/bin/wpa_supplicant( 2127):      41 44 44 20
30                                    ADD 0
I//system/bin/wpa_supplicant( 2127): RX ctrl_iface - hexdump_ascii
(len=22):
I//system/bin/wpa_supplicant( 2127):      44 52 49 56 45 52 20 42 54
43 4f 45 58 53 43 41   DRIVER BTCOEXSCA
I//system/bin/wpa_supplicant( 2127):      4e 2d 53 54 4f
50                                 N-STOP
....
....
I//system/bin/wpa_supplicant( 2127):      42 4c 41 43 4b 4c 49 53 54
20 63 6c 65 61 72      BLACKLIST clear
I//system/bin/wpa_supplicant( 2127): CTRL_IFACE: bssid=' clear'
I//system/bin/wpa_supplicant( 2127): Setting scan request: 0 sec 0
usec
I//system/bin/wpa_supplicant( 2127): No enabled networks - do not scan
I//system/bin/wpa_supplicant( 2127): State: INACTIVE -> INACTIVE
I//system/bin/wpa_supplicant( 2127): CTRL-EVENT-STATE-CHANGE id=-1
state=1
I//system/bin/wpa_supplicant( 2127): CTRL_IFACE monitor send - hexdump
(len=40): 2f 64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b
65 74 73 2f 77 70 61 5f 63 74 72 6c 5f 32 31 33 37 2d 31 00

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. after launching audio recording intent "MediaStoreAudio.Media.RECORD_SOUND_ACTION"

4. Do you have an example of layout like contact's form (add) ? (version 1.5)

5. Forecast widget for Android 1.5 (with source!)

6. Problem with Android Browser Application

7. G1 in the UK