Notes by freyo

Displaying notes 1 - 10
Created by freyo on September 29, 2011 16:01:31    Last update: September 29, 2011 16:09:37
With standalone broadcast receiver AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes... Java code: package com.android.networkreceiver; import... Register listener inside Activity programmatically AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes... Java code: package com.android.networklistener; import... Register/unregister broadcast receiver in onResume / onPause works because the connectivity change broadcast is sticky . I intentionally used two registerReceiver calls in onResume to demonstrate this - onReceive will be called once for each registration.
Created by freyo on September 29, 2011 15:43:12    Last update: September 29, 2011 15:43:12
I got this error while enabling/disabling wifi on an Android device: W/ActivityManager( 2735): Unable to launch app com... The receiver was registered for network connection change: <receiver android:name="NetworkReceiver"> ... This was fixed by just rebooting the device!
Created by freyo on September 15, 2011 20:29:22    Last update: September 21, 2011 13:16:36
Usually network connectivity can be tested with ping and telnet . Android adb shell has ping but no telnet . But it has nc , which can be used in place of telnet . # nc -z -v www.google.com 80 DNS fwd/rev mismat...
Created by freyo on September 15, 2011 16:23:14    Last update: September 21, 2011 13:06:00
These steps set up a PPP connection between an Android device and your Linux PC, so that the device can use the Internet connection of the PC. To share an Internet connection the other way around, reverse the roles of the PC and the device. Assuming the host will use IP address 192.168.0.1 and the device 192.168.0.2 : Prepare host for NAT and IP forwarding $ sudo sysctl net.ipv4.ip_forward=1 $ sudo ipta... The first rule is inserted at the beginning of the NAT table. The second and third rules are inserted into the second place in the rules chain. Start PPP with adb $ sudo adb ppp "shell:pppd nodetach noauth noipdef... Add DNS server to device (get dns server ip address from /etc/resolve.conf ): $ adb shell # setprop net.dns1 192.168.33.1 ...
Created by freyo on May 13, 2011 15:45:29    Last update: September 20, 2011 08:08:12
This is an Android app that dumps any binarized xml file as plain text - to the sdcard on the device or emulator. build.xml : <?xml version="1.0" encoding="UTF-8"?> <project... AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <man... res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> <Lin... res/values/strings.xml : <?xml version="1.0" encoding="utf-8"?> <res... src/com/android/xmltool/DumpXml.java package com.android.xmltool; import java.ut... Screenshot Pre-built APK can be downloaded from: http://code.google.com/p/android-binxml-dump/
Created by freyo on September 14, 2011 08:53:31    Last update: September 16, 2011 09:39:12
To list all parameters: $ sysctl -a To see one parameter: $ sysctl kernel.ostype kernel.ostype = Linux ... To change a parameter: $ sudo sysctl net.ipv4.ip_forward=1 To see values loaded at startup: $ cat /etc/sysctl.conf
Created by freyo on September 15, 2011 08:49:41    Last update: September 15, 2011 08:59:34
There's no UI for setting proxy for Android browser. You set a proxy by directly manipulating the settings db: $ android-sdk-linux_86/platform-tools/adb shell ... where wifi_http_proxy is the proxy host name and wifi_http_proxy is the proxy port number.
Created by freyo on September 14, 2011 16:30:03    Last update: September 14, 2011 16:30:03
Select from the system table: $ android-sdk-linux_86/platform-tools/adb shell ... Other useful commands: sqlite> .databases seq name file ...
Created by freyo on September 13, 2011 16:20:08    Last update: September 14, 2011 07:37:01
From ADB shell: show Android routing table: # cat /proc/net/route or # ip route show show DNS server: # getprop net.dns1 # getprop net.dns2 set DNS server: # setprop net.dns1 107.86.113.12 # setprop net.... add a default gateway # route add default gw 192.168.0.1 dev wifi
Created by freyo on September 09, 2011 11:43:36    Last update: September 09, 2011 11:45:45
When you run automated Android tests with Eclipse or from the command line, you get text output, which isn't good for reporting purposes. If you run a large set of test cases with automated build, the text report isn't very helpful. Fortunately, Android CTS generates test reports in XML with accompanying XSL to make it look nice in a browser. To run your own tests with Android CTS: Download Android CTS Make a new directory MyRepository under android-cts , alongside the existing repository directory. Copy host_config.xml from repository to MyRepository Create directory plans under MyRepository , add a test plan ( MyTests.xml ): <?xml version="1.0" encoding="UTF-8"?> <TestPla... Create directory testcases under MyRepository . Copy TestDeviceSetup.apk from repository/testcases to MyRepository/testcases Under MyRepository/testcases , create a test...
Previous  1 2 3 4 5 6 7 8 9 10 Next