Skip to content

Creating an HTTP Client Example

December 31, 2009

Hey everyone,

To conclude my series of examples on working with HTTP/web based Android programming, I thought I would include an example on how to set up a working HTTP Client that will allow you to do all of your POST/GET calls or whatever it is you might be looking to do. So here it is!

public DefaultHttpClient getClient() {
        DefaultHttpClient ret = null;

        //sets up parameters
        HttpParams params = new BasicHttpParams();
        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params, "utf-8");
        params.setBooleanParameter("http.protocol.expect-continue", false);

        //registers schemes for both http and https
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        final SSLSocketFactory sslSocketFactory = SSLSocketFactory.getSocketFactory();
        sslSocketFactory.setHostnameVerifier(SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
        registry.register(new Scheme("https", sslSocketFactory, 443));

        ThreadSafeClientConnManager manager = new ThreadSafeClientConnManager(params, registry);
        ret = new DefaultHttpClient(manager, params);
        return ret;
    }

So yes, if you ever encounter any annoying log errors saying things like “HTTPS SSL ERROR”, then it probably has something to do with how your HTTP Client is set up, and in my experience the example above works well in most cases!

Happy New Year! And Happy coding.

- jwei

About these ads
16 Comments leave one →
  1. January 8, 2010 10:29 am

    Good points, I think I will definitely subscribe! I’ll go and read some more! What do you see the future of this being?

  2. Mark permalink
    February 4, 2010 1:56 pm

    If anyone gets the error messages here…

    The method getSocketFactory() is undefined for the type SSLSocketFactory
    SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER cannot be resolved
    The constructor Scheme(String, SSLSocketFactory, int) is undefined

    Be sure to import “org.apache.http.conn.ssl.SSLSocketFactory” not “javax.net.ssl.SSLSocketFactory”

    Thanks for the article, however I still get “android javax.net.ssl.SSLException: Not trusted server certificate” on the 2.1SDK

  3. Michele permalink
    March 2, 2010 5:21 am

    i still get the Not trusted certificate exception on the 1.5 sdk too… how avoid it? thanks for the article, anyway!!! :D

    • March 2, 2010 11:26 am

      Hmm okay I will check this out and hopefully get back to you with an answer! Thanks for the comments!

      - jwei

  4. barkha permalink
    March 8, 2010 6:16 am

    52.

    hello guys!!

    i’ve just gone through the above example and i’m trying to connect with my Server i.e. on local host only through HTTPs but it’s showing this log and it connects with server but not able to return the String which i’m writing on server’s out put stream.

    The emulator logcat..
    03-08 18:15:26.767: ERROR/mountd(19): could not read initial mass storage state
    03-08 18:15:26.777: INFO/DEBUG(20): debuggerd: Feb 5 2009 15:37:59
    03-08 18:15:27.077: ERROR/flash_image(28): can’t find recovery partition
    03-08 18:15:27.777: DEBUG/AndroidRuntime(23): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<id=65536 devname=’qwerty2 propName=’hw.keyboards.65536.devname’ keylayout=’/system/usr/keylayout/qwerty.kl’
    03-08 18:15:40.127: INFO/SystemServer(46): Registering null Bluetooth Service (emulator)
    03-08 18:15:40.137: ERROR/EventHub(46): could not get driver version for /dev/input/mouse0, Not a typewriter
    03-08 18:15:40.137: ERROR/System(46): Failure starting core service
    03-08 18:15:40.137: ERROR/System(46): java.lang.SecurityException
    03-08 18:15:40.137: ERROR/System(46): at android.os.BinderProxy.transact(Native Method)
    03-08 18:15:40.137: ERROR/System(46): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
    03-08 18:15:40.137: ERROR/System(46): at android.os.ServiceManager.addService(ServiceManager.java:72)
    03-08 18:15:40.137: ERROR/System(46): at com.android.server.ServerThread.run(SystemServer.java:155)
    03-08 18:15:40.146: ERROR/AndroidRuntime(46): Crash logging skipped, no checkin service
    03-08 18:15:40.146: INFO/SystemServer(46): Starting Status Bar Service.
    03-08 18:15:40.166: ERROR/EventHub(46): could not get driver version for /dev/input/mice, Not a typewriter
    03-08 18:15:40.166: INFO/KeyInputQueue(46): Device added: id=0×0, name=qwerty2, classes=7
    03-08 18:15:40.166: INFO/KeyInputQueue(46): X: unknown values
    03-08 18:15:40.166: INFO/KeyInputQueue(46): Y: unknown values
    03-08 18:15:40.166: INFO/KeyInputQueue(46): Pressure: unknown values
    03-08 18:15:40.166: INFO/KeyInputQueue(46): Size: unknown values
    03-08 18:15:40.336: INFO/WindowManager(46): Input configuration changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/2 nav=3 orien=1 }
    03-08 18:15:40.507: ERROR/SystemServer(46): Failure starting StatusBarService
    03-08 18:15:40.507: ERROR/SystemServer(46): java.lang.NullPointerException
    03-08 18:15:40.507: ERROR/SystemServer(46): at com.android.server.status.StatusBarPolicy.updateBluetooth(StatusBarPolicy.java:762)
    03-08 18:15:40.507: ERROR/SystemServer(46): at com.android.server.status.StatusBarPolicy.(StatusBarPolicy.java:285)
    03-08 18:15:40.507: ERROR/SystemServer(46): at com.android.server.status.StatusBarPolicy.installIcons(StatusBarPolicy.java:341)
    03-08 18:15:40.507: ERROR/SystemServer(46): at com.android.server.ServerThread.run(SystemServer.java:182)
    03-08 18:15:40.517: ERROR/AndroidRuntime(46): Crash logging skipped, no checkin service
    03-08 18:15:40.517: INFO/SystemServer(46): Starting Hardware Service.
    03-08 18:15:40.517: INFO/SystemServer(46): Starting NetStat Service.
    03-08 18:15:40.526: INFO/SystemServer(46): Starting Connectivity Service.
    03-08 18:15:40.626: DEBUG/WifiService(46): WifiService starting up with Wi-Fi disabled
    03-08 18:15:40.677: INFO/SystemServer(46): Starting Notification Manager.
    03-08 18:15:40.686: INFO/SystemServer(46): Starting Mount Service.
    03-08 18:15:40.697: INFO/SystemServer(46): Starting DeviceMemoryMonitor service
    03-08 18:15:40.706: DEBUG/MountListener(46): handleEvent ums_disconnected
    03-08 18:15:40.725: DEBUG/MountListener(46): handleEvent ums_disabled
    03-08 18:15:40.749: INFO/SystemServer(46): Starting Location Manager.
    03-08 18:15:40.757: DEBUG/LocationManagerService(46): Constructed LocationManager Service
    03-08 18:15:40.786: INFO/System.out(46): #### #### Setting locale to en_US
    03-08 18:15:40.815: DEBUG/libhardware(46): using QEMU GPS Hardware emulation
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): Could not open GPS configuration file /etc/gps.conf
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): java.io.FileNotFoundException: /etc/gps.conf
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:227)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at java.io.FileInputStream.(FileInputStream.java:76)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at com.android.internal.location.GpsLocationProvider.(GpsLocationProvider.java:179)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at com.android.server.LocationManagerService._loadProvidersNoSync(LocationManagerService.java:356)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at com.android.server.LocationManagerService.loadProvidersNoSync(LocationManagerService.java:340)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at com.android.server.LocationManagerService.loadProviders(LocationManagerService.java:333)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at com.android.server.LocationManagerService.(LocationManagerService.java:447)
    03-08 18:15:40.827: ERROR/GpsLocationProvider(46): at com.android.server.ServerThread.run(SystemServer.java:235)
    03-08 18:15:40.837: ERROR/AndroidRuntime(46): Crash logging skipped, no checkin service
    03-08 18:15:40.847: DEBUG/GpsLocationProvider(46): enable
    03-08 18:15:40.877: DEBUG/GpsLocationProvider(46): GpsEventThread starting
    03-08 18:15:40.896: DEBUG/GpsLocationProvider(46): NetworkThread starting
    03-08 18:15:40.896: DEBUG/GpsLocationProvider(46): NetworkThread wait for network
    03-08 18:15:40.917: INFO/SystemServer(46): Starting Search Service.
    03-08 18:15:40.927: INFO/SystemServer(46): Starting Clipboard Service.
    03-08 18:15:40.946: INFO/SystemServer(46): Starting Checkin Service
    03-08 18:15:41.216: DEBUG/dalvikvm(46): GC freed 4349 objects / 264608 bytes in 104ms
    03-08 18:15:41.337: INFO/RecoverySystem(46): No recovery log file
    03-08 18:15:41.347: INFO/RecoverySystem(46): No recovery intent file
    03-08 18:15:41.405: WARN/CheckinService(46): No saved kernel log file
    03-08 18:15:41.437: INFO/SystemServer(46): Starting Wallpaper Service
    03-08 18:15:41.437: DEBUG/WallpaperService(46): WallpaperService startup
    03-08 18:15:41.446: INFO/SystemServer(46): Starting Audio Service
    03-08 18:15:41.667: INFO/SystemServer(46): Starting HeadsetObserver
    03-08 18:15:41.677: WARN/HeadsetObserver(46): This kernel does not have wired headset support
    03-08 18:15:41.696: INFO/WindowManager(46): Menu key state: 0
    03-08 18:15:41.696: DEBUG/PowerManagerService(46): system ready!
    03-08 18:15:41.726: DEBUG/ActivityManager(46): Start running!
    03-08 18:15:41.816: INFO/Zygote(46): Process: zygote socket opened
    03-08 18:15:41.856: INFO/ActivityManager(46): Start proc com.android.phone for added application com.android.phone: pid=82 uid=1001 gids={3001, 3003}
    03-08 18:15:41.927: INFO/ActivityManager(46): Starting activity: Intent { action=android.intent.action.MAIN categories={android.intent.category.HOME} flags=0×10000000 comp={com.android.launcher/com.android.launcher.Launcher} }
    03-08 18:15:42.066: INFO/ActivityManager(46): Start proc android.process.acore for activity com.android.launcher/.Launcher: pid=88 uid=10005 gids={3003}
    03-08 18:15:42.339: INFO/jdwp(46): received file descriptor 60 from ADB
    03-08 18:15:42.366: INFO/jdwp(82): received file descriptor 13 from ADB
    03-08 18:15:42.427: WARN/System.err(82): Can’t dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:42.427: WARN/System.err(82): Can’t dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:42.455: INFO/jdwp(88): received file descriptor 10 from ADB
    03-08 18:15:42.546: WARN/System.err(46): Can’t dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:42.546: WARN/System.err(46): Can’t dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:42.597: WARN/System.err(88): Can’t dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:42.597: WARN/System.err(88): Can’t dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:43.086: INFO/ActivityThread(88): Publishing provider com.android.googlesearch.SuggestionProvider: com.android.googlesearch.SuggestionProvider
    03-08 18:15:43.427: INFO/ActivityThread(82): Publishing provider mms-sms: com.android.providers.telephony.MmsSmsProvider
    03-08 18:15:43.517: INFO/ActivityThread(88): Publishing provider im: com.android.providers.im.ImProvider
    03-08 18:15:43.686: INFO/ActivityThread(82): Publishing provider mms: com.android.providers.telephony.MmsProvider
    03-08 18:15:43.736: INFO/ActivityThread(82): Publishing provider telephony: com.android.providers.telephony.TelephonyProvider
    03-08 18:15:43.866: INFO/ActivityThread(82): Publishing provider sms: com.android.providers.telephony.SmsProvider
    03-08 18:15:43.926: INFO/ActivityThread(88): Publishing provider contacts;call_log: com.android.providers.contacts.ContactsProvider
    03-08 18:15:43.967: INFO/ActivityThread(82): Publishing provider sim: com.android.phone.SimProvider
    03-08 18:15:44.346: DEBUG/AndroidRuntime(103): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
    03-08 18:15:55.965: DEBUG/AndroidRuntime(159): CheckJNI is ON
    03-08 18:15:56.567: DEBUG/AndroidRuntime(159): — registering native functions —
    03-08 18:15:57.255: DEBUG/dalvikvm(82): GC freed 2759 objects / 169752 bytes in 466ms
    03-08 18:15:58.886: INFO/ActivityManager(46): Starting activity: Intent { flags=0×10000000 comp={com.android.test/com.android.test.AndroidTestAPP} }
    03-08 18:15:58.996: DEBUG/AndroidRuntime(159): Shutting down VM
    03-08 18:15:58.996: DEBUG/dalvikvm(159): DestroyJavaVM waiting for non-daemon threads to exit
    03-08 18:15:59.027: INFO/dalvikvm(159): DestroyJavaVM shutting VM down
    03-08 18:15:59.027: DEBUG/dalvikvm(159): HeapWorker thread shutting down
    03-08 18:15:59.037: DEBUG/dalvikvm(159): HeapWorker thread has shut down
    03-08 18:15:59.037: DEBUG/jdwp(159): JDWP shutting down net…
    03-08 18:15:59.066: DEBUG/dalvikvm(159): VM cleaning up
    03-08 18:15:59.076: ERROR/dalvikvm(159): pthread_setspecific failed, err=22
    03-08 18:15:59.107: DEBUG/dalvikvm(159): LinearAlloc 0×0 used 539556 of 4194304 (12%)
    03-08 18:15:59.207: INFO/jdwp(128): received file descriptor 24 from ADB
    03-08 18:15:59.207: INFO/ActivityManager(46): Start proc com.android.test for activity com.android.test/.AndroidTestAPP: pid=169 uid=10021 gids={3003}
    03-08 18:15:59.256: INFO/jdwp(137): received file descriptor 26 from ADB
    03-08 18:15:59.256: WARN/System.err(128): Can't dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:59.286: WARN/System.err(128): Can't dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:59.375: WARN/System.err(137): Can't dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:59.415: WARN/System.err(137): Can't dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:59.526: INFO/jdwp(169): received file descriptor 10 from ADB
    03-08 18:15:59.647: WARN/System.err(169): Can't dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:59.736: DEBUG/SystemClock(82): Setting time of day to sec=1268052347
    03-08 18:15:47.239: WARN/SystemClock(82): Unable to set rtc to 1268052347: Invalid argument
    03-08 18:15:47.859: DEBUG/PhoneApp(82): [CallNotifier] onMwiChanged(): false
    03-08 18:15:47.871: DEBUG/PhoneApp(82): [CallNotifier] onCfiChanged(): false
    03-08 18:15:48.129: INFO/ActivityManager(46): Displayed activity com.android.test/.AndroidTestAPP: 1613 ms
    03-08 18:15:48.609: WARN/ActivityManager(46): Timeout of broadcast BroadcastRecord{434c4440 android.intent.action.SCREEN_ON} – receiver=android.os.BinderProxy@43506098
    03-08 18:15:48.609: WARN/ActivityManager(46): Receiver during timeout: BroadcastFilter{43506300 ReceiverList{43506288 82 com.android.phone/1001 client 43506098}}
    03-08 18:15:48.630: INFO/ActivityManager(46): ANR (application not responding) in process: com.android.phone
    03-08 18:15:48.630: INFO/ActivityManager(46): Annotation: Broadcast of Intent { action=android.intent.action.SCREEN_ON flags=0×40000000 }
    03-08 18:15:48.630: INFO/ActivityManager(46): CPU usage:
    03-08 18:15:48.630: INFO/ActivityManager(46): Load: 1.94 / 0.45 / 0.15
    03-08 18:15:48.630: INFO/ActivityManager(46): CPU usage from 6302ms to 1125ms ago:
    03-08 18:15:48.630: INFO/ActivityManager(46): com.android.phone: 28% = 26% user + 1% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): system_server: 14% = 9% user + 4% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): adbd: 4% = 1% user + 3% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): android.process.acore: 4% = 3% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): logcat: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): com.google.process.gapps: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): zygote: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): com.android.mms: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): +com.android.test: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): -sh: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): -app_process: 0% = 0% user + 0% kernel
    03-08 18:15:48.630: INFO/ActivityManager(46): TOTAL: 100% = 77% user + 21% kernel + 0% irq + 0% softirq
    03-08 18:15:48.630: INFO/ActivityManager(46): /proc/meminfo:
    03-08 18:15:48.630: INFO/ActivityManager(46): MemTotal: 94572 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): MemFree: 17592 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Buffers: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Cached: 44396 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): SwapCached: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Active: 42304 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Inactive: 27544 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): SwapTotal: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): SwapFree: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Dirty: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Writeback: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): AnonPages: 25468 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Mapped: 21272 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Slab: 2856 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): SReclaimable: 580 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): SUnreclaim: 2276 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): PageTables: 2024 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): NFS_Unstable: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Bounce: 0 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): CommitLimit: 47284 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): Committed_AS: 698180 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): VmallocTotal: 876544 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): VmallocUsed: 8380 kB
    03-08 18:15:48.630: INFO/ActivityManager(46): VmallocChunk: 859132 kB
    03-08 18:15:48.640: INFO/ActivityManager(46): Removing old ANR trace file from /data/anr/traces.txt
    03-08 18:15:48.640: INFO/Process(46): Sending signal. PID: 169 SIG: 3
    03-08 18:15:48.649: INFO/dalvikvm(169): threadid=7: reacting to signal 3
    03-08 18:15:48.661: INFO/Process(46): Sending signal. PID: 128 SIG: 3
    03-08 18:15:48.661: INFO/dalvikvm(128): threadid=7: reacting to signal 3
    03-08 18:15:48.661: INFO/Process(46): Sending signal. PID: 137 SIG: 3
    03-08 18:15:48.661: INFO/dalvikvm(137): threadid=7: reacting to signal 3
    03-08 18:15:48.670: INFO/Process(46): Sending signal. PID: 88 SIG: 3
    03-08 18:15:48.670: INFO/dalvikvm(88): threadid=7: reacting to signal 3
    03-08 18:15:48.670: INFO/Process(46): Sending signal. PID: 82 SIG: 3
    03-08 18:15:48.670: INFO/dalvikvm(82): threadid=7: reacting to signal 3
    03-08 18:15:48.670: INFO/Process(46): Sending signal. PID: 46 SIG: 3
    03-08 18:15:48.680: INFO/dalvikvm(46): threadid=7: reacting to signal 3
    03-08 18:15:48.729: INFO/dalvikvm(137): Wrote stack trace to '/data/anr/traces.txt'
    03-08 18:15:48.729: INFO/dalvikvm(169): Wrote stack trace to '/data/anr/traces.txt'
    03-08 18:15:48.770: INFO/dalvikvm(88): Wrote stack trace to '/data/anr/traces.txt'
    03-08 18:15:48.770: INFO/dalvikvm(46): Wrote stack trace to '/data/anr/traces.txt'
    03-08 18:15:48.811: INFO/dalvikvm(128): Wrote stack trace to '/data/anr/traces.txt'
    03-08 18:15:48.831: INFO/dalvikvm(82): Wrote stack trace to '/data/anr/traces.txt'
    03-08 18:15:48.889: WARN/ActivityManager(46): finishReceiver called but none active
    03-08 18:15:49.349: DEBUG/dalvikvm(46): GC freed 4863 objects / 359528 bytes in 111ms
    03-08 18:15:49.620: DEBUG/StatusBar(46): updateResources
    03-08 18:15:49.830: INFO/ActivityManager(46): Start proc com.android.alarmclock for broadcast com.android.alarmclock/.AlarmInitReceiver: pid=175 uid=10001 gids={}
    03-08 18:15:50.010: INFO/jdwp(175): received file descriptor 20 from ADB
    03-08 18:15:50.029: DEBUG/PhoneApp(82): [CallNotifier] onMwiChanged(): false
    03-08 18:15:50.050: DEBUG/PhoneApp(82): [CallNotifier] onCfiChanged(): false
    03-08 18:15:50.269: WARN/System.err(175): Can't dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:50.549: DEBUG/TelephonyProvider(82): Setting numeric '310260' to be the current operator
    03-08 18:15:50.571: INFO/ARMAssembler(46): generated scanline__00000077:03515104_00000000_00000000 [ 27 ipp] (41 ins) at [0x26b550:0x26b5f4] in 11147786 ns
    03-08 18:15:50.591: INFO/ActivityManager(46): processNextBroadcast: waiting for ProcessRecord{43507238 175:com.android.alarmclock/10001}
    03-08 18:15:50.739: INFO/ActivityThread(175): Publishing provider com.android.alarmclock: com.android.alarmclock.AlarmProvider
    03-08 18:15:51.020: DEBUG/MobileDataStateTracker(46): CONNECTED event did not supply interface name.
    03-08 18:15:51.031: DEBUG/MobileDataStateTracker(46): DNS server addresses are not known.
    03-08 18:15:51.060: ERROR/NetworkStateTracker(46): net.tcp.buffersize.unknown not found in system properties. Using defaults
    03-08 18:15:51.060: ERROR/NetworkStateTracker(46): Can't set tcp buffer sizes:java.io.FileNotFoundException: /sys/kernel/ipv4/tcp_rmem_min
    03-08 18:15:51.249: DEBUG/GpsLocationProvider(46): updateNetworkState available
    03-08 18:15:51.259: DEBUG/GpsLocationProvider(46): NetworkThread out of wake loop
    03-08 18:15:51.269: DEBUG/GpsLocationProvider(46): Requesting time from NTP server pool.ntp.org
    03-08 18:15:51.480: INFO/ActivityManager(46): Start proc com.google.android.apps.maps for broadcast com.google.android.apps.maps/com.google.android.maps.ff.FriendFinderReceiver: pid=186 uid=10000 gids={3003}
    03-08 18:15:51.509: DEBUG/SntpClient(46): round trip: 78 ms
    03-08 18:15:51.509: DEBUG/SntpClient(46): clock offset: 49416 ms
    03-08 18:15:51.509: DEBUG/GpsLocationProvider(46): calling native_inject_time: 1268052400852 reference: 39547 certainty: 39
    03-08 18:15:51.509: DEBUG/GpsLocationProvider(46): NetworkThread wait for 14400000ms
    03-08 18:15:51.590: INFO/jdwp(186): received file descriptor 10 from ADB
    03-08 18:15:51.661: WARN/System.err(186): Can't dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:51.670: WARN/System.err(186): Can't dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:52.030: DEBUG/dalvikvm(46): GC freed 2359 objects / 126064 bytes in 232ms
    03-08 18:15:52.059: INFO/ActivityThread(186): Publishing provider com.google.android.maps.SuggestionProvider: com.google.android.maps.provider.MapsSuggestionProvider
    03-08 18:15:52.129: INFO/ActivityThread(186): Publishing provider com.google.android.maps.FriendsProvider: com.google.android.maps.ff.FriendsProvider
    03-08 18:15:52.139: INFO/ActivityThread(186): Publishing provider com.google.android.maps.SearchHistoryProvider: com.google.android.maps.provider.SearchHistoryProvider
    03-08 18:15:52.493: DEBUG/Maps.FriendFinder(186): Starting FriendView service
    03-08 18:15:52.679: INFO/ActivityManager(46): Start proc android.process.media for broadcast com.android.providers.downloads/.DownloadReceiver: pid=193 uid=10004 gids={1006, 3003, 2001}
    03-08 18:15:52.751: INFO/jdwp(193): received file descriptor 20 from ADB
    03-08 18:15:52.840: WARN/System.err(193): Can't dispatch DDM chunk 46454154: no handler defined
    03-08 18:15:52.840: WARN/System.err(193): Can't dispatch DDM chunk 4d505251: no handler defined
    03-08 18:15:52.960: INFO/ActivityThread(193): Publishing provider downloads: com.android.providers.downloads.DownloadProvider
    03-08 18:15:53.001: INFO/ActivityThread(193): Publishing provider drm: com.android.providers.drm.DrmProvider
    03-08 18:15:53.040: INFO/ActivityThread(193): Publishing provider media: com.android.providers.media.MediaProvider
    03-08 18:15:53.109: VERBOSE/MediaProvider(193): Attached volume: internal
    03-08 18:15:53.570: DEBUG/MediaScannerService(193): start scanning volume internal
    03-08 18:15:54.000: DEBUG/dalvikvm(46): GREF has increased to 201
    03-08 18:15:54.509: INFO/ActivityManager(46): Stopping service: com.android.mms/.transaction.TransactionService
    03-08 18:15:54.699: INFO/ActivityManager(46): Stopping service: com.android.providers.downloads/.DownloadService
    03-08 18:15:54.809: DEBUG/MediaScanner(193): prescan time: 828ms
    03-08 18:15:54.831: DEBUG/MediaScanner(193): scan time: 309ms
    03-08 18:15:54.841: DEBUG/MediaScanner(193): postscan time: 1ms
    03-08 18:15:54.850: DEBUG/MediaScanner(193): total time: 1138ms
    03-08 18:15:54.860: DEBUG/MediaScannerService(193): done scanning volume internal
    03-08 18:15:54.870: INFO/ActivityManager(46): Stopping service: com.android.providers.media/.MediaScannerService
    03-08 18:15:54.950: INFO/ActivityManager(46): Stopping service: com.android.mms/.transaction.SmsReceiverService
    03-08 18:15:59.389: DEBUG/dalvikvm(82): GC freed 3836 objects / 200328 bytes in 86ms
    03-08 18:16:05.229: DEBUG/dalvikvm(88): GC freed 2332 objects / 111488 bytes in 69ms
    03-08 18:16:10.260: DEBUG/dalvikvm(128): GC freed 2573 objects / 139104 bytes in 92ms
    03-08 18:16:52.901: DEBUG/KeyguardViewMediator(46): pokeWakelock(5000)
    03-08 18:17:03.559: INFO/global(169): Mar 8, 2010 6:17:03 PM java.io.BufferedReader
    03-08 18:17:03.559: INFO/global(169): INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if a 8k-char buffer is required.
    03-08 18:17:03.571: INFO/System.out(169): READ LINE………..null

    here instead of null i need a string which i’m writing on server.

    please anybody help me.it’s urgent.

    Thanks,
    Barkha

  5. Dante permalink
    November 20, 2010 3:30 am

    jwei512, i want to know where I can say to httpConnection the timeout of connection. I Make my own the http connection but when i get connected, send a post and the IP don exist’s on the network my APP freezes…

    How i can fix it? If necessary I can put some codes here…

    Thank you very much, sorry my english!

  6. Vittorio permalink
    December 1, 2010 1:28 pm

    I’m experiencing the “Not trusted server certificate” error too.
    Did you find a solution ?

  7. Swati permalink
    December 21, 2010 2:44 am

    how we call this code on android main page

  8. mohan permalink
    January 6, 2011 9:39 am

    HI,
    I want to make a https SSL connectivity from my Android APP. How can it be done in Android?
    Any Sample program .Can anyone help me in solving this issue?

  9. mani permalink
    February 24, 2011 8:18 am

    Failure in SSL library, usually a protocol error

  10. anddev mania permalink
    May 4, 2011 7:12 pm

    hello android developers,

    can you help me how to create script to request data from website using httpclient with form login access.

    the login form using httppost to store the cookies about information session login, and than request data using httpget with cookies information session login.

    thanks..

Trackbacks

  1. Google App Engine – Bringing it Back To Android (4) « Think Android
  2. Google App Engine – Bringing it Back To Android (4) « Mr. Android
  3. Tutorial: Requesting RESTful Web Services with JSON in your Android App « Ingo Hofmann's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 845 other followers

%d bloggers like this: